[hibernate-dev] Hibernate ORM 4.1.1 release - Undocumented behavior change in Optimistic Versioning ?

Demetz, Guenther Guenther.Demetz at wuerth-phoenix.com
Fri Mar 9 08:53:20 EST 2012


Thank you Steve,

anyway in this context 
I strongly recommend all Hibernate-Users to force version increment explicitly on such OneToMany relations when the mapped collection is a map!
Otherwise, unless implementing some pessimistick locking, 2 concurrent transactions will be able to insert an object in the map, each indipendently from the other, using the same key value, without getting any exception at flush or commit time.
This leads finally in having 2 records persisted on database whilst in hibernate (due the constraints of the map) on successive accesses you always will see just one. This is quite dangereous.

regards
G.D.




More information about the hibernate-dev mailing list