Re: reload model each time

2012-04-15 Thread Christoph Leiter

On 14.04.2012 16:38, Emmanouil Batsis (Manos) wrote:

On 04/14/2012 03:03 PM, Christoph Leiter wrote:

Here's a good article about EntityModel, which does what you want:

http://wicketinaction.com/2008/09/building-a-smart-entitymodel/


Sorry for jumping in but wanted to make sure I get this right. In the
example given above, does it make sense to conditionally set the entity
to null within detach() based on whether the object has been persisted
(i.e. id != null in my case) or not?


Sure, that's what happens in the last listing. :)


My intention is to serialize the model object when that not yet
persisted to handle multistep create forms etc., making this a generic
model implementation for al my CRUD operations.


Good idea. Just keep in mind that you can't use an EntityModel if the 
entity has already been persisted and if you want to change it with 
multiple ajax requests/multistep forms. It will lose any changes on 
every request. Simply serialize the entity again for that use case.



Christoph

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: reload model each time

2012-04-15 Thread Tom Eugelink




Just keep in mind that you can't use an EntityModel if the entity has already 
been persisted and if you want to change it with multiple ajax 
requests/multistep forms. It will lose any changes on every request. Simply 
serialize the entity again for that use case.


Stealing the thread back ;-)

Have't had time to work with this model (weekend and all) but I am visualizing 
it. The question I had is: if I have a from in a web browser that modifies 
several points in the backing model, and an AJAX requests comes in, will the 
full change set that is in the browser's form be applied to the model?

Tom



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



reload model each time

2012-04-14 Thread Tom Eugelink


Another newbie question; it is now the case that each model is serialized 
between requests and (I presume) stored in the session. I would really prefer 
if a identifier (primary key + lazy locking versionnr) could be remembered and 
that each time when Wicket needs the model, it is loaded from the database.

Is this possible? Is there something like a ReloadingModel?

Tom



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: reload model each time

2012-04-14 Thread Josh Kamau
Look at LoadableDetachableModels .

Josh.

On Sat, Apr 14, 2012 at 2:38 PM, Tom Eugelink t...@tbee.org wrote:


 Another newbie question; it is now the case that each model is serialized
 between requests and (I presume) stored in the session. I would really
 prefer if a identifier (primary key + lazy locking versionnr) could be
 remembered and that each time when Wicket needs the model, it is loaded
 from the database.

 Is this possible? Is there something like a ReloadingModel?

 Tom



 --**--**-
 To unsubscribe, e-mail: 
 users-unsubscribe@wicket.**apache.orgusers-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: reload model each time

2012-04-14 Thread Christoph Leiter

Here's a good article about EntityModel, which does what you want:

http://wicketinaction.com/2008/09/building-a-smart-entitymodel/


Christoph

Tom Eugelink (2012-04-14 13:38):


Another newbie question; it is now the case that each model is
serialized between requests and (I presume) stored in the session. I
would really prefer if a identifier (primary key + lazy locking
versionnr) could be remembered and that each time when Wicket needs the
model, it is loaded from the database.

Is this possible? Is there something like a ReloadingModel?

Tom



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: reload model each time

2012-04-14 Thread Emmanouil Batsis (Manos)

On 04/14/2012 03:03 PM, Christoph Leiter wrote:

Here's a good article about EntityModel, which does what you want:

http://wicketinaction.com/2008/09/building-a-smart-entitymodel/


Sorry for jumping in but wanted to make sure I get this right. In the 
example given above, does it make sense to conditionally set the entity 
to null within detach() based on whether the object has been persisted 
(i.e. id != null in my case) or not?


My intention is to serialize the model object when that not yet 
persisted to handle multistep create forms etc., making this a generic 
model implementation for al my CRUD operations.


Manos



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: reload model each time

2012-04-14 Thread Tom Eugelink


Thanks! This looks very promising!


On 2012-04-14 14:03, Christoph Leiter wrote:

Here's a good article about EntityModel, which does what you want:

http://wicketinaction.com/2008/09/building-a-smart-entitymodel/


Christoph




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: reload model each time

2012-04-14 Thread Robert Szmurlo

W dniu 2012-04-14 13:38, Tom Eugelink pisze:


Another newbie question; it is now the case that each model is serialized 
between requests and (I presume) stored in the session. I would really prefer 
if a identifier (primary key + lazy locking versionnr) could be remembered and 
that each time when Wicket needs the model, it is loaded from the database.

AFAIK by default Wicket serializes pages and its attributes to a filestore on a 
disk in a servlet container and the session is not affected. So you don't have 
to worry about its size. But, of course for large objects and specially list 
you should use LoadableDetachableModels.


Is this possible? Is there something like a ReloadingModel?

See section Detachable Models and specially LoadableDetachableModel in 
https://cwiki.apache.org/WICKET/working-with-wicket-models.html


Robert

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org