• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Optimistic lock

 
Alexandre Fradin
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I found an error into Mikalai's guide, but like it's a reference, I prefer ask your opinion....

http://java.boot.by/scbcd5-guide/ch06.html

If you attempt to merge an instance whose representation has changed in the datastore since detachment, the merge operation will throw an exception, or the transaction in which you perform the merge will fail on commit, just as if a normal optimistic conflict were detected.

It does not look like JSR220.... Persistence specifications say :

3.2.4.1 Any Version columns used by the entity must be checked by the persistence runtime implementation
during the merge operation and/or at flush or commit time. In the absence of Version columns there is
no additional version checking done by the persistence provider runtime during the merge operation

3.4 The persistence provider runtime is only required to use the version attribute when performing optimistic
lock checking. Persistence provider implementations may provide additional mechanisms beside
version attributes to enable optimistic lock checking. However, support for such mechanisms is not
required of an implementation of this specification.[

Is it an error in Mikalai's guide?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I'd also say that it differs from the spec as it does not take into consideration the Version column.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic