-->
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.  [ 2 posts ] 
Author Message
 Post subject: Select for update in SQL Server dialect?
PostPosted: Tue Feb 27, 2007 8:26 pm 
Beginner
Beginner

Joined: Thu Oct 14, 2004 10:53 pm
Posts: 45
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

[b]version 2.1.7:[/b]

I would like to have two implementations of TableHiLoGenerator running in my application. Both id generators access the same SQL Server database, which contains the hibernate_unique_key table. Obviously I don't want both implementations grabbing the same seed value from the hibernate_unique_key table to prevent primary key collisions, so I believe Hibernate's TableHiLoGenerator uses a "select for update" query to lock the table from read access when the seed value is read and updated.

However, the SQLServerDialect doesn't seem to support this, as its supportsForUpdate() method returns false. Does this mean in SQLServer that I cannot lock the table to prevent concurrent access by my two TableHiLoGenerator implementations? What can I do to ensure that my two implementations do not grab the same seed value.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 28, 2007 5:39 pm 
Beginner
Beginner

Joined: Thu Oct 14, 2004 10:53 pm
Posts: 45
I think in SQLServer Dialect for hibernate 3, there is a locking hint method, which introduces locking hints for the query. This is only in hibernate 3 however. So I guess my solution won't work if using Hibernate 2.1.7.


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