Hibernate version: 3.0
Code between sessionFactory.openSession() and session.close():
Using the Open Session View.
Session hSession = HibernateUtil.getSession();
HibernateUtil.beginTransaction();
String del = "delete content where status=:status";
hSession.createQuery( del)
.setString( "status", status )
.executeUpdate();
hSession.flush();
// at this poing table is still locked
// bunch of other code
hSession.flush();
HibernateUtil.commitTransaction();
Name and version of the database you are using:
MS SQL 2000
Its a long transaction runs about 2 minutes total. The problem is that while its running other applications cant use same table. the SQL Manager shows TABLE lock. I dont use any LockModes exclusively and I tried setting my isolation in hibernate.cfg.xml to 1 and 2 as:
<property name="connection.isolation">1</property>
Still tables are not being released until the final commitTransaction called. Any way I can avoid table lock on that delete statement?
Thanks, Oleg
|