Hi Dale,
Dale Newfield wrote:
Rob Hills wrote:
A record sitting in the db has the version no 0.
User A opens a form to edit the record and hibernate increments the
version to 1.
As far as hibernate is concerned, I don't understand how there is any
difference between "load an object to show a view of it" and "load an
object to show an edit view of it". I certainly don't want to have to
make a change to my database every time I read out of it...
Multiple users should be able to load the same edit form with the same
version number, and only the first to submit that form should be able
to successfully save their changes, because as part of that save the
version number should increment, which means subsequent submits of the
same form (with the now stale version) will no longer match, and can
be rejected.
You make a valid point and on reflection, I think the normal case is
that an Action edit method does NOT cause Hibernate to modify the version.
In my app, somewhere between the end of my "edit" method and the start
of my "save" method, Hibernate is incrementing the version number. My
guess is that somewhere in the OGNL machinations of my JSP, something is
causing Hibernate to write something to the record and increment the
version. I've not been able to discover what that is, as no changes are
made to the business data.
I'm now going down the track of doing everything from the Grandparent
record, and then saving that Grandparent record at the end. That
increases the risk of real-life version conflicts, but for this app, the
use case is such that that risk is actually small anyway. I've
completed the tests for this approach and they run fine, so we'll see
how we go with the real thing.
Cheers,
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]