-->
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: Pessimistic locking with SQL Server (7,2000,2005)
PostPosted: Mon Apr 10, 2006 1:51 pm 
Newbie

Joined: Fri Apr 07, 2006 8:33 pm
Posts: 6
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)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 11, 2006 7:14 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Right, this is not supported in the current version. Please enter a JIRA issue to have this ported from H3. By the way, H3 uses "with (updlock, rowlock)".

I'm not going to implement this in 1.0.2 at this time because I'm focused on the new version.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 13, 2006 10:06 am 
Newbie

Joined: Mon Nov 13, 2006 10:02 am
Posts: 3
I'm currently evaluating NHibernate 1.0.3, and found some problems with this issue.
The (updlock, rowlock) SQL Statements is currently planned in some NHibernate version?

Anyway, thanks for NHibernate. This is a very, very good solution. Something in "Black Magic" level for me.. ;-)


Top
 Profile  
 
 Post subject: How about version 1.2
PostPosted: Tue Nov 14, 2006 4:59 am 
Newbie

Joined: Tue Jan 17, 2006 5:00 am
Posts: 16
Is pessimistic locking handled for SQL Server 2005 for version 1.2?


Top
 Profile  
 
 Post subject: Re: How about version 1.2
PostPosted: Mon Nov 20, 2006 2:22 pm 
Newbie

Joined: Mon Nov 13, 2006 10:02 am
Posts: 3
Jensegutt wrote:
Is pessimistic locking handled for SQL Server 2005 for version 1.2?


I downloaded the 1.2 beta and the SQL Server Profiler told me that it don't support yet. :-(


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.