When I try to commit my session and another user also changed that same object, then Hibernate throws a StaleObjectStateException
.
When I try to recover from that exception I call:
session.refresh(<staleObject>)
Then I once again call the commit that previously failed. But the staleObjectStateException
occurs once again on the same object. Even if there are no changes made by another user, I also verified that the version number of the object is the same as the number in our DB.
Anyone know what might be wrong? Does anyone have a better idea on how to gracefully handle the exception without closing and opening a new session?
note: we use a Single Session per View implementation for our desktop (RCP) application