Hi,
so far we have faired well using a optimistic locking approach in our application, but now I need to implement pessimistic locking, since I have to make sure, that multiple users(<20) do not concurrently edit the same orders (within a review process).
To implement the pessimistic locking I am using session.lock(x, Lockmode.UPGRADE_NOWAIT) to do a synchronisation against the "order" object.
Later, after the user has made his changes and they are persisted to the database, I release the object by calling
session.lock(x, Lockmode.None).
What I could not figure out is how to make sure, that the row-lock is released, if the user decides to close the browser or if the application crashes. Here, it would be nice, if the database would release the lock after a
n minutes. How can this be achieved?
I am using Oracle 9i, Hibernate 3.1.2 and JBoss AS
Thx in advance for you help
|