-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Locking tables on delete
PostPosted: Thu Oct 04, 2007 8:45 pm 
Newbie

Joined: Fri May 27, 2005 3:19 pm
Posts: 18
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.