It appears that NHibernate 1.x doesn't support SQL Server (7,2000,2005) locking hints which appear immediately after the table (as opposed to the generic 'for update' statements like Oracle does).
Is this correct? I searched JIRA, but could find no current issue. Should I create an issue on this, or is it already in the works?
This is a pretty major deficiency (don't worry, I love NHibernate, I'm not dogging!) and probably should be fixed ASAP (rather than the next major version).
If you don't know what I'm talking about, then consider the following example:
I need to lock a range of rows -- and I mean LOCK, no one can even read them or do anything with them until I'm done (this is a queueing type situation, so this is necessary).
In SQL Server, the way you go about doing that is:
Code:
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
BEGIN TRANSACTION
SELECT * FROM DocumentVersion WITH (HOLDLOCK, XLOCK) WHERE ...
COMMIT TRANSACTION
SET TRANSACTION ISOLATION LEVEL READ COMMITTED
Currently, I can't find a way to accomplish this using NHibernate proper (without devolving into queries or other unslightliness).
(edit: Forgot the 'XLOCK' in the lock hints)