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.