-->
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.  [ 5 posts ] 
Author Message
 Post subject: Load with LockMode.UPGRADE doesn't lock with SQLServer
PostPosted: Mon Jun 20, 2005 3:13 am 
Newbie

Joined: Mon Jun 20, 2005 2:55 am
Posts: 2
We have recently migrated a product from hibernate 2.1.x to 3.0.x in the hope we could remove an ugly kludge for locking objects in SQLServer.

Hibernate 3.0 added support for the (rowlock, updlock) but this appears to only work when directly calling lock. If you call load with a lock mode the lock hint is not added. Loading with a lock mode seems to work for all other DB types (that support for update syntax). Is this expected behaviour?

I tracked the problem down to org.hibernate.sql.Select. It is not calling Dialect.appendLockHint (and can't really as there could be multiple tables involved).

The workaround is to load the object then lock it.

Any help would be appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 20, 2005 3:45 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
http://forum.hibernate.org/viewtopic.ph ... highlight=


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 20, 2005 8:02 am 
Newbie

Joined: Mon Jun 20, 2005 2:55 am
Posts: 2
Thanks. How on earth did i not find that post?

I guess it is back to SQL kludge :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 20, 2005 8:16 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
What's the reason not to use Session.lock()?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 28, 2005 7:57 pm 
Beginner
Beginner

Joined: Thu Feb 17, 2005 9:20 pm
Posts: 36
Location: Vancouver, WA
alesj wrote:
What's the reason not to use Session.lock()?

I am having the same issue. Answer is, I do not need to load entity if it cannot be locked for any reason.

_________________
Vasyl Zhabko


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