Quote:
business object in two different sessions, the two instances will actually be "different" (JVM identity). Conflicts are resolved using (automatic versioning) at flush/commit time, using an optimistic approach.
This means that the two objects live in two different sessions and they continue to do so.
If BOTH sessions are comitted then conflicts will be resolved with the help of optimistic locking. Optimistic locking requires that you have a
version or
timestamp property on your entity. If only one of the objects have been modified everything will be ok and both transactions will succeed (with or without optimistic locking). But if both objects has been modified, the second transaction will:
* Fail with a StaleStateException (if optimistic locking is used)
* Overwrite the changes from the first transaction (if optimistic locking is not used)