in memory, then after the update and before the application commit to the db, behind the scene, Hibernate does the second read against the current row on the database and get the image2, and then compare image1 and image2, if there is no difference, then the commit is allowed to proceed, otherwise, throw the "StaleObjectStateException".
Currently, as I know, many J2EE containers like Websphere and Borland Enterprise Server (BES) have alreadHi,
I am currently reading the "5.2.1 Using managed versioning" on the Hibernate in Action book. I have the following question regarding this optimistic lock implementation using the lock version or time stamp:
1. As the section mentions that "...For Hibernate managed versioning, we must add a new property to our Comment class and map it as a version number using the <version> tag...". In this case, it means the user of Hibernate has to do the followings in order to use this versioning support from Hibernate: must to define a properties in a persistence class and, to define a corresponsible field on the table.
I am just wondering, can all of these to be completely transparent to the user, say -- the end user doesn't need to define any additional properties or field for this purpose, instead just simply to specify something like "modifyVerifiedOptimisticLock" on the Hibernate mapping, and then, Hibernate will handle this transparently for the user?
I think this is possible, because before the update to take place, Hibernate could just first read in the current state of the row from database and get the image1 y provided this optimistic locking feature transparent to the user using their CMP entity bean implementation.
Do you have any comments on this or I may have misunderstood this issue? If so, please correct.
Thanks
Victor
|