Perhaps I am missing something, but based on my understanding of the reference guide (section 5.1.3, containing the quote from my original post), optimistic-locking="all" or "dirty" cause issues when modifications are made outside the session. The reference also says that select-before-update basically only checks whether you have modified data before performing an update, but the system would not know if someone else modified the data between sessions (would it?). How does your solution handle the following case:
Code:
// foo is an instance loaded by a previous Session
foo.setProperty("bar");
session = factory.openSession();
session.update(foo);
session.flush();
session.connection().commit();
session.close();
...if someone else has modified the data between when foo is loaded and when the new session is opened?
Sorry if I am just misinterpreting the reference, as I am still not entirely sure why it recommends against optimistic-locking="all" or "dirty" when modifications are made outside of the session.
Thanks again,
-Joe