Hi all.  I'm new to wicket.  I was reading in the Wicket In Action book on
LoadableDetachedModels...particularly how when the model is detached, just
the id of the actual database persistent object is stored.  Then, in the
load method, you retrieve the persistent object from the database.  That all
makes sense.

However, I then read one use case for this, at
http://stronglytypedblog.blogspot.com/2009/03/wicket-patterns-and-pitfalls-1.html.
 The idea is that you retrieve the object from the database to present
in
a form, and then when a person submits the form, you retrieve the object
from the database again, apply any needed changes, and then persist the
object.

Isn't there a problem here related to versioning of objects?  Specifically,
the first time I retrieve an object, it could be at version 1.  The next
time I retrieve the object, to apply the values from the form, I could be
retrieving version 4.  I would then apply the changes from the form, and
hibernate would happily persist the object, because version 4 is the most
current.

On the other hand, if I kept the version 1 model in the session, and then
applied the form values to it, and then tried to persist it, and in the
meantime other changes had caused the version in the database to increase to
4, hibernate would (properly) throw an error because I am not persisting a
change to the most current version.

David

Reply via email to