-->
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.  [ 4 posts ] 
Author Message
 Post subject: releasing row lock
PostPosted: Mon Dec 06, 2004 1:11 pm 
Hibernate version:2.1.7
Name and version of the database you are using: oracle 9

I'm locking an object via:

Code:

session = factory.openSession();
mutex = session.get(..., LockMode.UPGRADE);

tx = session.beginTransaction();

...

tx.commit();
session.flush();
session.lock(mutex, LockMode.NONE);
session.close();


The factory continues to live, so does the jdbc connection (as intended) but on the oracle enterprise manager I can see that the row is still locked, thus when trying to lock it from another JVM the lock just hangs there.

How can I unlock the object (without shutting down the jdbc connection)?

Thanks
G.


Top
  
 
 Post subject:
PostPosted: Mon Dec 06, 2004 3:59 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Locks are normally released when the transaction is completed.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 06, 2004 3:59 pm 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
commit or rollback releases all locks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 07, 2004 4:16 am 
michael wrote:
Locks are normally released when the transaction is completed.


Dear Michael & Balikulas

It seems that the sequence was wrong... the lock is obtained before the transaction is created and this might explain why the lock outlives the transaction. Once I changed the code to lock after the transaction was created, everything worked as intended.

Thanx for your help

G.


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

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.