-->
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: Supporting SQL Server READPAST lock hint
PostPosted: Fri Aug 12, 2005 4:06 am 
Senior
Senior

Joined: Thu Jun 02, 2005 5:03 pm
Posts: 135
Location: Paris
Hi,

I have a situation where I need to retrieve an object from SQL Server where the locking hints are READPAST and UPDLOCK so that the search performed will skip any records already locked for update and will then lock the remaining matches for update.

Example - I have two queue monitors running on separate machines that each need to get an item off the queue and then udpate it if appropriate (such as update the QueueStatus field). It's important that each machine not obtain a record the other has selected. The following SQL will accomplish this:

Code:
SELECT TOP 1
   *
FROM
   Queue
WITH
   (UPDLOCK, READPAST)
WHERE
   UserID = @UserID AND
   QueueStatus = 0


I see that there's an UPGRATE_NOWAIT option but I don't believe this is an equivalent - am I wrong?

So, if this isn't possible with the current implementation of the LockMode enum is this functionality feasible to add to the NHibernate codebase?

Cheers,

Symon.


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.