Hello, I am currently supporting an application that uses Hibernate 3.5 and JBoss 5.1.0. The system is set up to use container managed sessions so jBoss is handling our session scope for us. We are using Oracle 10 and 11 Databases.
I've noticed that when we search for a single row and lock it pessimistically using sess.lock(object,LockMode.UPGRADE) it generates a SELECT..FOR UPDATE statement which produces a lock on a row in the table. However, when we later update that row, the lock is not removed. Instead it isn't until our application has gone through the complete render cycle (jsp render) and the session is closed by JBoss that the lock is released.
I have tried using sess.lock(object,LockMode.NONE), sess.getTransaction().commit() and many other methods but I cannot get the lock to release before the session is closed. Is this a limitation of container managed transactions? Should I be using bean managed transactions in this case?
Any feedback is appreciated. Thanks!
|