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

Reply via email to