-->
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.  [ 2 posts ] 
Author Message
 Post subject: How to acquire read lock on a row through hibernate?
PostPosted: Thu Mar 22, 2012 4:52 am 
Newbie

Joined: Wed Dec 15, 2010 9:14 am
Posts: 2
Hi,

I need to know how can i acquire a read lock on a row through hibernate so that multiple instances can read the row but no one can update it or fail while acquiring a UPGRADE/UPGRADE_NOWAIT or any other kind data modification lock?

Right now we are doing something like getHibernateTemplate().get( SomeEntity.class, objId, LockMode.UPGRADE_NOWAIT ), but most of the time we are not updating the row, because of this lock mode other threads trying to acquire same sort of lock will fail resulting into cannot acquire lock exception.

Please post if you have any solution for this.

Thanks
ankey


Top
 Profile  
 
 Post subject: Re: How to acquire read lock on a row through hibernate?
PostPosted: Thu Mar 22, 2012 5:00 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
This depends on which hibernate dialect you are using (= how method Dialect.getReadLockString(int timeout) is overriden/implemented)
Which hibernate dialect do you use? And which Hiberate version?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.