In the normal case, as the spec says, the version is not "touched" by the application. So there is no "new value", it is the same as at the first retrieval moment. So it compares the database value to that one, which is not artificially changed. Therefore, it is not always failling, as you assume.
But when calling lock(write) the spec says it increments the version immediatly. And this incremented value becomes the reference for comparison with the database.
Maybe, once again, i am wrong.
Concerning my last post, i just wanted to know if you saw what i meant, and if you agreed there is a distinction between lost-updates and dirty-reads and that lock() is only concerned wth lost-updates. Just wanted your confimation, not an immediate change of the javadoc which is not in your power.
Thanks a lot for your replies.
[Message sent by forum member 'vladbalan' (vladbalan)]
http://forums.java.net/jive/thread.jspa?messageID=316863