Could not find a coercion from type java.lang.String to type org.tapdemo.demo.entity.TimeSheet

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Could not find a coercion from type java.lang.String to type org.tapdemo.demo.entity.TimeSheet

George Christman
Hi Guys, I have a form contained within a zone where I'm passing an object
into the context value. When I submit the form I get the following
exception.

*parameter #1: org.apache.tapestry5.ioc.util.UnknownValueException: Could
not find a coercion from type java.lang.String to type
org.tapdemo.demo.entity.TimeSheet.*

.tml

<t:zone t:id="formZone" id="formZone">
        <t:form t:id="form" zone="formZone" context="ts">

        <t:submit t:event="save" context="action.notification"/>

java class

public enum Action {
        WARNING, NOTIFICATION, CERTIFICATION
}

@Property
    private TimeSheetEntity ts;

public void onPrepareForSubmitFromForm(TimeSheetEntity ts) {
    this.ts = ts;
    }

    public void onSave(Action action) {
        this.action = action;
    }

Aren't you able to pass an object into context? Any ideas what might be
happening here?

--
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York
Reply | Threaded
Open this post in threaded view
|

RE: Could not find a coercion from type java.lang.String to type org.tapdemo.demo.entity.TimeSheet

Brush_B_is_Silent
Hey George. I had a very similar situation. What you can do here is to make a new Encoder and put it into appropriate field. Take a look at my example.

   private class DateEncoder implements ValueEncoder<Date> {

        @Override
        public String toClient(Date date) {
            long timeMillis = date.getTime();
            return Long.toString(timeMillis);
        }

        @Override
        public Date toValue(String timeMillisAsString) {
            long timeMillis = Long.parseLong(timeMillisAsString);
            Date date = new Date(timeMillis);
            return date;
        }

    }


                       
                       
                       

                       
                       
                       
                       
                       

                    and I put into a grid( in your case it will be grid ) encoder value, something like encoder="dateEncoder". This should work just fine for your case.


> Date: Fri, 24 Oct 2014 11:02:02 -0400
> Subject: Could not find a coercion from type java.lang.String to type org.tapdemo.demo.entity.TimeSheet
> From: [hidden email]
> To: [hidden email]
>
> Hi Guys, I have a form contained within a zone where I'm passing an object
> into the context value. When I submit the form I get the following
> exception.
>
> *parameter #1: org.apache.tapestry5.ioc.util.UnknownValueException: Could
> not find a coercion from type java.lang.String to type
> org.tapdemo.demo.entity.TimeSheet.*
>
> .tml
>
> <t:zone t:id="formZone" id="formZone">
>         <t:form t:id="form" zone="formZone" context="ts">
>
>         <t:submit t:event="save" context="action.notification"/>
>
> java class
>
> public enum Action {
>         WARNING, NOTIFICATION, CERTIFICATION
> }
>
> @Property
>     private TimeSheetEntity ts;
>
> public void onPrepareForSubmitFromForm(TimeSheetEntity ts) {
>     this.ts = ts;
>     }
>
>     public void onSave(Action action) {
>         this.action = action;
>     }
>
> Aren't you able to pass an object into context? Any ideas what might be
> happening here?
>
> --
> George Christman
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
     
Reply | Threaded
Open this post in threaded view
|

Re: Could not find a coercion from type java.lang.String to type org.tapdemo.demo.entity.TimeSheet

George Christman
Unfortunately the valueencoder is not an option for the form component.

On Fri, Oct 24, 2014 at 11:09 AM, Name Surname <[hidden email]>
wrote:

> Hey George. I had a very similar situation. What you can do here is to
> make a new Encoder and put it into appropriate field. Take a look at my
> example.
>
>    private class DateEncoder implements ValueEncoder<Date> {
>
>         @Override
>         public String toClient(Date date) {
>             long timeMillis = date.getTime();
>             return Long.toString(timeMillis);
>         }
>
>         @Override
>         public Date toValue(String timeMillisAsString) {
>             long timeMillis = Long.parseLong(timeMillisAsString);
>             Date date = new Date(timeMillis);
>             return date;
>         }
>
>     }
>
>
>
>
>
>
>
>
>
>
>
>
>                     and I put into a grid( in your case it will be grid )
> encoder value, something like encoder="dateEncoder". This should work just
> fine for your case.
>
>
> > Date: Fri, 24 Oct 2014 11:02:02 -0400
> > Subject: Could not find a coercion from type java.lang.String to type
> org.tapdemo.demo.entity.TimeSheet
> > From: [hidden email]
> > To: [hidden email]
> >
> > Hi Guys, I have a form contained within a zone where I'm passing an
> object
> > into the context value. When I submit the form I get the following
> > exception.
> >
> > *parameter #1: org.apache.tapestry5.ioc.util.UnknownValueException: Could
> > not find a coercion from type java.lang.String to type
> > org.tapdemo.demo.entity.TimeSheet.*
> >
> > .tml
> >
> > <t:zone t:id="formZone" id="formZone">
> >         <t:form t:id="form" zone="formZone" context="ts">
> >
> >         <t:submit t:event="save" context="action.notification"/>
> >
> > java class
> >
> > public enum Action {
> >         WARNING, NOTIFICATION, CERTIFICATION
> > }
> >
> > @Property
> >     private TimeSheetEntity ts;
> >
> > public void onPrepareForSubmitFromForm(TimeSheetEntity ts) {
> >     this.ts = ts;
> >     }
> >
> >     public void onSave(Action action) {
> >         this.action = action;
> >     }
> >
> > Aren't you able to pass an object into context? Any ideas what might be
> > happening here?
> >
> > --
> > George Christman
> > www.CarDaddy.com
> > P.O. Box 735
> > Johnstown, New York
>
>



--
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York
Reply | Threaded
Open this post in threaded view
|

Re: Could not find a coercion from type java.lang.String to type org.tapdemo.demo.entity.TimeSheet

Chris Poulsen
Pass the object key as a simple type (string/long) and setup the object in
the PREPARE_FOR_SUBMIT handler.



On Fri, Oct 24, 2014 at 5:22 PM, George Christman <[hidden email]>
wrote:

> Unfortunately the valueencoder is not an option for the form component.
>
> On Fri, Oct 24, 2014 at 11:09 AM, Name Surname <[hidden email]
> >
> wrote:
>
> > Hey George. I had a very similar situation. What you can do here is to
> > make a new Encoder and put it into appropriate field. Take a look at my
> > example.
> >
> >    private class DateEncoder implements ValueEncoder<Date> {
> >
> >         @Override
> >         public String toClient(Date date) {
> >             long timeMillis = date.getTime();
> >             return Long.toString(timeMillis);
> >         }
> >
> >         @Override
> >         public Date toValue(String timeMillisAsString) {
> >             long timeMillis = Long.parseLong(timeMillisAsString);
> >             Date date = new Date(timeMillis);
> >             return date;
> >         }
> >
> >     }
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >                     and I put into a grid( in your case it will be grid )
> > encoder value, something like encoder="dateEncoder". This should work
> just
> > fine for your case.
> >
> >
> > > Date: Fri, 24 Oct 2014 11:02:02 -0400
> > > Subject: Could not find a coercion from type java.lang.String to type
> > org.tapdemo.demo.entity.TimeSheet
> > > From: [hidden email]
> > > To: [hidden email]
> > >
> > > Hi Guys, I have a form contained within a zone where I'm passing an
> > object
> > > into the context value. When I submit the form I get the following
> > > exception.
> > >
> > > *parameter #1: org.apache.tapestry5.ioc.util.UnknownValueException:
> Could
> > > not find a coercion from type java.lang.String to type
> > > org.tapdemo.demo.entity.TimeSheet.*
> > >
> > > .tml
> > >
> > > <t:zone t:id="formZone" id="formZone">
> > >         <t:form t:id="form" zone="formZone" context="ts">
> > >
> > >         <t:submit t:event="save" context="action.notification"/>
> > >
> > > java class
> > >
> > > public enum Action {
> > >         WARNING, NOTIFICATION, CERTIFICATION
> > > }
> > >
> > > @Property
> > >     private TimeSheetEntity ts;
> > >
> > > public void onPrepareForSubmitFromForm(TimeSheetEntity ts) {
> > >     this.ts = ts;
> > >     }
> > >
> > >     public void onSave(Action action) {
> > >         this.action = action;
> > >     }
> > >
> > > Aren't you able to pass an object into context? Any ideas what might be
> > > happening here?
> > >
> > > --
> > > George Christman
> > > www.CarDaddy.com
> > > P.O. Box 735
> > > Johnstown, New York
> >
> >
>
>
>
> --
> George Christman
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
>
Reply | Threaded
Open this post in threaded view
|

Re: Could not find a coercion from type java.lang.String to type org.tapdemo.demo.entity.TimeSheet

George Christman
I'm facing a problem where the object hasn't yet been committed to the db
and there for the object has no id. This is probably the root of this
exception.

 I'm trying to build an ajax wizard where each step has it's own ajax form
and the db commit will be handled at the end. I was hoping to just pass in
the value form form A into the context of form B, but that may not be
possible without an id.

I suppose I could use @SessionState or in the past I've copied the form
data from form a to form b and sent the original form data out of view, but
I've been hoping to come up with a better solution than those two since
processing form A data requires a lot of system resources.

On Fri, Oct 24, 2014 at 11:35 AM, Chris Poulsen <[hidden email]>
wrote:

> Pass the object key as a simple type (string/long) and setup the object in
> the PREPARE_FOR_SUBMIT handler.
>
>
>
> On Fri, Oct 24, 2014 at 5:22 PM, George Christman <[hidden email]
> >
> wrote:
>
> > Unfortunately the valueencoder is not an option for the form component.
> >
> > On Fri, Oct 24, 2014 at 11:09 AM, Name Surname <
> [hidden email]
> > >
> > wrote:
> >
> > > Hey George. I had a very similar situation. What you can do here is to
> > > make a new Encoder and put it into appropriate field. Take a look at my
> > > example.
> > >
> > >    private class DateEncoder implements ValueEncoder<Date> {
> > >
> > >         @Override
> > >         public String toClient(Date date) {
> > >             long timeMillis = date.getTime();
> > >             return Long.toString(timeMillis);
> > >         }
> > >
> > >         @Override
> > >         public Date toValue(String timeMillisAsString) {
> > >             long timeMillis = Long.parseLong(timeMillisAsString);
> > >             Date date = new Date(timeMillis);
> > >             return date;
> > >         }
> > >
> > >     }
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >                     and I put into a grid( in your case it will be
> grid )
> > > encoder value, something like encoder="dateEncoder". This should work
> > just
> > > fine for your case.
> > >
> > >
> > > > Date: Fri, 24 Oct 2014 11:02:02 -0400
> > > > Subject: Could not find a coercion from type java.lang.String to type
> > > org.tapdemo.demo.entity.TimeSheet
> > > > From: [hidden email]
> > > > To: [hidden email]
> > > >
> > > > Hi Guys, I have a form contained within a zone where I'm passing an
> > > object
> > > > into the context value. When I submit the form I get the following
> > > > exception.
> > > >
> > > > *parameter #1: org.apache.tapestry5.ioc.util.UnknownValueException:
> > Could
> > > > not find a coercion from type java.lang.String to type
> > > > org.tapdemo.demo.entity.TimeSheet.*
> > > >
> > > > .tml
> > > >
> > > > <t:zone t:id="formZone" id="formZone">
> > > >         <t:form t:id="form" zone="formZone" context="ts">
> > > >
> > > >         <t:submit t:event="save" context="action.notification"/>
> > > >
> > > > java class
> > > >
> > > > public enum Action {
> > > >         WARNING, NOTIFICATION, CERTIFICATION
> > > > }
> > > >
> > > > @Property
> > > >     private TimeSheetEntity ts;
> > > >
> > > > public void onPrepareForSubmitFromForm(TimeSheetEntity ts) {
> > > >     this.ts = ts;
> > > >     }
> > > >
> > > >     public void onSave(Action action) {
> > > >         this.action = action;
> > > >     }
> > > >
> > > > Aren't you able to pass an object into context? Any ideas what might
> be
> > > > happening here?
> > > >
> > > > --
> > > > George Christman
> > > > www.CarDaddy.com
> > > > P.O. Box 735
> > > > Johnstown, New York
> > >
> > >
> >
> >
> >
> > --
> > George Christman
> > www.CarDaddy.com
> > P.O. Box 735
> > Johnstown, New York
> >
>



--
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York
Reply | Threaded
Open this post in threaded view
|

Re: Could not find a coercion from type java.lang.String to type org.tapdemo.demo.entity.TimeSheet

Lance Java
Instead of null ids, you could give your unsaved entities unique ids that
are negative. This would require a smart enough ValueEncoder that would NOT
attempt to lookup negative ids from the database.

It's all sounding a bit hack so you might prefer to pass around a wrapper
object which knows if the object has been persisted yet or not. Perhaps an
entity that has been persisted might encode as "P:123" and a new entity not
yet persisted would encode as "N:123".
Reply | Threaded
Open this post in threaded view
|

RE: Could not find a coercion from type java.lang.String to type org.tapdemo.demo.entity.TimeSheet

Brush_B_is_Silent
In reply to this post by George Christman
What you can do is to make @Persist(PersistanceConstants.CLIENT) and retrieve only id of the object ( not object, because it may go to broken reference ) of the object between AJAX calls. With that id pass values of that object between calls. It's much safer and consumes less server resources than @SessionState.

> Date: Fri, 24 Oct 2014 11:50:04 -0400
> Subject: Re: Could not find a coercion from type java.lang.String to type org.tapdemo.demo.entity.TimeSheet
> From: [hidden email]
> To: [hidden email]
>
> I'm facing a problem where the object hasn't yet been committed to the db
> and there for the object has no id. This is probably the root of this
> exception.
>
>  I'm trying to build an ajax wizard where each step has it's own ajax form
> and the db commit will be handled at the end. I was hoping to just pass in
> the value form form A into the context of form B, but that may not be
> possible without an id.
>
> I suppose I could use @SessionState or in the past I've copied the form
> data from form a to form b and sent the original form data out of view, but
> I've been hoping to come up with a better solution than those two since
> processing form A data requires a lot of system resources.
>
> On Fri, Oct 24, 2014 at 11:35 AM, Chris Poulsen <[hidden email]>
> wrote:
>
> > Pass the object key as a simple type (string/long) and setup the object in
> > the PREPARE_FOR_SUBMIT handler.
> >
> >
> >
> > On Fri, Oct 24, 2014 at 5:22 PM, George Christman <[hidden email]
> > >
> > wrote:
> >
> > > Unfortunately the valueencoder is not an option for the form component.
> > >
> > > On Fri, Oct 24, 2014 at 11:09 AM, Name Surname <
> > [hidden email]
> > > >
> > > wrote:
> > >
> > > > Hey George. I had a very similar situation. What you can do here is to
> > > > make a new Encoder and put it into appropriate field. Take a look at my
> > > > example.
> > > >
> > > >    private class DateEncoder implements ValueEncoder<Date> {
> > > >
> > > >         @Override
> > > >         public String toClient(Date date) {
> > > >             long timeMillis = date.getTime();
> > > >             return Long.toString(timeMillis);
> > > >         }
> > > >
> > > >         @Override
> > > >         public Date toValue(String timeMillisAsString) {
> > > >             long timeMillis = Long.parseLong(timeMillisAsString);
> > > >             Date date = new Date(timeMillis);
> > > >             return date;
> > > >         }
> > > >
> > > >     }
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >                     and I put into a grid( in your case it will be
> > grid )
> > > > encoder value, something like encoder="dateEncoder". This should work
> > > just
> > > > fine for your case.
> > > >
> > > >
> > > > > Date: Fri, 24 Oct 2014 11:02:02 -0400
> > > > > Subject: Could not find a coercion from type java.lang.String to type
> > > > org.tapdemo.demo.entity.TimeSheet
> > > > > From: [hidden email]
> > > > > To: [hidden email]
> > > > >
> > > > > Hi Guys, I have a form contained within a zone where I'm passing an
> > > > object
> > > > > into the context value. When I submit the form I get the following
> > > > > exception.
> > > > >
> > > > > *parameter #1: org.apache.tapestry5.ioc.util.UnknownValueException:
> > > Could
> > > > > not find a coercion from type java.lang.String to type
> > > > > org.tapdemo.demo.entity.TimeSheet.*
> > > > >
> > > > > .tml
> > > > >
> > > > > <t:zone t:id="formZone" id="formZone">
> > > > >         <t:form t:id="form" zone="formZone" context="ts">
> > > > >
> > > > >         <t:submit t:event="save" context="action.notification"/>
> > > > >
> > > > > java class
> > > > >
> > > > > public enum Action {
> > > > >         WARNING, NOTIFICATION, CERTIFICATION
> > > > > }
> > > > >
> > > > > @Property
> > > > >     private TimeSheetEntity ts;
> > > > >
> > > > > public void onPrepareForSubmitFromForm(TimeSheetEntity ts) {
> > > > >     this.ts = ts;
> > > > >     }
> > > > >
> > > > >     public void onSave(Action action) {
> > > > >         this.action = action;
> > > > >     }
> > > > >
> > > > > Aren't you able to pass an object into context? Any ideas what might
> > be
> > > > > happening here?
> > > > >
> > > > > --
> > > > > George Christman
> > > > > www.CarDaddy.com
> > > > > P.O. Box 735
> > > > > Johnstown, New York
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > > George Christman
> > > www.CarDaddy.com
> > > P.O. Box 735
> > > Johnstown, New York
> > >
> >
>
>
>
> --
> George Christman
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
     
Reply | Threaded
Open this post in threaded view
|

Re: Could not find a coercion from type java.lang.String to type org.tapdemo.demo.entity.TimeSheet

George Christman
In reply to this post by Lance Java
Lance, even if I were to give the object a temp id or put it in a wrapper
object, wouldn't that value be lost as soon as the zone finishes rendering?
It seems to me as if I have three choices, session, commit, or copy form
data from form a to b. Your thoughts?

On Fri, Oct 24, 2014 at 12:02 PM, Lance Java <[hidden email]>
wrote:

> Instead of null ids, you could give your unsaved entities unique ids that
> are negative. This would require a smart enough ValueEncoder that would NOT
> attempt to lookup negative ids from the database.
>
> It's all sounding a bit hack so you might prefer to pass around a wrapper
> object which knows if the object has been persisted yet or not. Perhaps an
> entity that has been persisted might encode as "P:123" and a new entity not
> yet persisted would encode as "N:123".
>



--
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York
Reply | Threaded
Open this post in threaded view
|

Re: Could not find a coercion from type java.lang.String to type org.tapdemo.demo.entity.TimeSheet

Kalle Korhonen-2
In reply to this post by Lance Java
I agree with Lance, but I just want to comment on the overall problem.
Unless the per-step lifetime in your wizard is in the order of a few
seconds, you are, in my opinion, unnecessarily optimizing to reduce
database operations (and if it was in the order a few seconds, a wizard
might not be the right UI flow). Just writing the state of a logical
incomplete operation to the database has lots of benefits, like increased
reliability and trackability. It's likely that only a few percents of your
users are inputting data (i.e. causing write operations) compared to the
number of causing read operations, so any modern database backend is likely
to be able to cope with the load without a hitch.

Just my two cents,
Kalle

On Fri, Oct 24, 2014 at 9:02 AM, Lance Java <[hidden email]>
wrote:

> Instead of null ids, you could give your unsaved entities unique ids that
> are negative. This would require a smart enough ValueEncoder that would NOT
> attempt to lookup negative ids from the database.
>
> It's all sounding a bit hack so you might prefer to pass around a wrapper
> object which knows if the object has been persisted yet or not. Perhaps an
> entity that has been persisted might encode as "P:123" and a new entity not
> yet persisted would encode as "N:123".
>
Reply | Threaded
Open this post in threaded view
|

Re: Could not find a coercion from type java.lang.String to type org.tapdemo.demo.entity.TimeSheet

Lance Java
In reply to this post by George Christman
I'm not sure I fully understand the problem. I thought the form contained
all the data so all you needed was a new object to populate.

If not, Kalle's suggestion of saving temp state to the db sounds OK to me.
Perhaps with a scheduled task to clear out incomplete wizards after some
period of inactivity. Good for marketing situations where you can send an
email suggesting users complete the wizard.

If you want to maintain a stateless wizard, you could use a ValueEncoder
which puts all values in the encoded clientside string (eg json or
similar).
On 24 Oct 2014 17:27, "George Christman" <[hidden email]> wrote:

> Lance, even if I were to give the object a temp id or put it in a wrapper
> object, wouldn't that value be lost as soon as the zone finishes rendering?
> It seems to me as if I have three choices, session, commit, or copy form
> data from form a to b. Your thoughts?
>
> On Fri, Oct 24, 2014 at 12:02 PM, Lance Java <[hidden email]>
> wrote:
>
> > Instead of null ids, you could give your unsaved entities unique ids that
> > are negative. This would require a smart enough ValueEncoder that would
> NOT
> > attempt to lookup negative ids from the database.
> >
> > It's all sounding a bit hack so you might prefer to pass around a wrapper
> > object which knows if the object has been persisted yet or not. Perhaps
> an
> > entity that has been persisted might encode as "P:123" and a new entity
> not
> > yet persisted would encode as "N:123".
> >
>
>
>
> --
> George Christman
> www.CarDaddy.com
> P.O. Box 735
> Johnstown, New York
>
Reply | Threaded
Open this post in threaded view
|

Re: Could not find a coercion from type java.lang.String to type org.tapdemo.demo.entity.TimeSheet

Thiago H de Paula Figueiredo
Implementing your own ValueEncoder and contribute it to ValueEncoderSource  
should be enough to get this working.

On Fri, 24 Oct 2014 16:33:52 -0200, Lance Java <[hidden email]>  
wrote:

> I'm not sure I fully understand the problem. I thought the form contained
> all the data so all you needed was a new object to populate.
>
> If not, Kalle's suggestion of saving temp state to the db sounds OK to  
> me.
> Perhaps with a scheduled task to clear out incomplete wizards after some
> period of inactivity. Good for marketing situations where you can send an
> email suggesting users complete the wizard.
>
> If you want to maintain a stateless wizard, you could use a ValueEncoder
> which puts all values in the encoded clientside string (eg json or
> similar).
> On 24 Oct 2014 17:27, "George Christman" <[hidden email]> wrote:
>
>> Lance, even if I were to give the object a temp id or put it in a  
>> wrapper
>> object, wouldn't that value be lost as soon as the zone finishes  
>> rendering?
>> It seems to me as if I have three choices, session, commit, or copy form
>> data from form a to b. Your thoughts?
>>
>> On Fri, Oct 24, 2014 at 12:02 PM, Lance Java <[hidden email]>
>> wrote:
>>
>> > Instead of null ids, you could give your unsaved entities unique ids  
>> that
>> > are negative. This would require a smart enough ValueEncoder that  
>> would
>> NOT
>> > attempt to lookup negative ids from the database.
>> >
>> > It's all sounding a bit hack so you might prefer to pass around a  
>> wrapper
>> > object which knows if the object has been persisted yet or not.  
>> Perhaps
>> an
>> > entity that has been persisted might encode as "P:123" and a new  
>> entity
>> not
>> > yet persisted would encode as "N:123".
>> >
>>
>>
>>
>> --
>> George Christman
>> www.CarDaddy.com
>> P.O. Box 735
>> Johnstown, New York
>>


--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Could not find a coercion from type java.lang.String to type org.tapdemo.demo.entity.TimeSheet

George Christman
I think I'm just going to save the values to the db, however for future
knowledge how do i use a value encoder with a form?
On Oct 24, 2014 3:15 PM, "Thiago H de Paula Figueiredo" <[hidden email]>
wrote:

> Implementing your own ValueEncoder and contribute it to ValueEncoderSource
> should be enough to get this working.
>
> On Fri, 24 Oct 2014 16:33:52 -0200, Lance Java <[hidden email]>
> wrote:
>
>  I'm not sure I fully understand the problem. I thought the form contained
>> all the data so all you needed was a new object to populate.
>>
>> If not, Kalle's suggestion of saving temp state to the db sounds OK to me.
>> Perhaps with a scheduled task to clear out incomplete wizards after some
>> period of inactivity. Good for marketing situations where you can send an
>> email suggesting users complete the wizard.
>>
>> If you want to maintain a stateless wizard, you could use a ValueEncoder
>> which puts all values in the encoded clientside string (eg json or
>> similar).
>> On 24 Oct 2014 17:27, "George Christman" <[hidden email]> wrote:
>>
>>  Lance, even if I were to give the object a temp id or put it in a wrapper
>>> object, wouldn't that value be lost as soon as the zone finishes
>>> rendering?
>>> It seems to me as if I have three choices, session, commit, or copy form
>>> data from form a to b. Your thoughts?
>>>
>>> On Fri, Oct 24, 2014 at 12:02 PM, Lance Java <[hidden email]>
>>> wrote:
>>>
>>> > Instead of null ids, you could give your unsaved entities unique ids
>>> that
>>> > are negative. This would require a smart enough ValueEncoder that would
>>> NOT
>>> > attempt to lookup negative ids from the database.
>>> >
>>> > It's all sounding a bit hack so you might prefer to pass around a
>>> wrapper
>>> > object which knows if the object has been persisted yet or not. Perhaps
>>> an
>>> > entity that has been persisted might encode as "P:123" and a new entity
>>> not
>>> > yet persisted would encode as "N:123".
>>> >
>>>
>>>
>>>
>>> --
>>> George Christman
>>> www.CarDaddy.com
>>> P.O. Box 735
>>> Johnstown, New York
>>>
>>>
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>