-->
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: MS SQL Server 2000 and record-updates in a multiuser env.
PostPosted: Thu Oct 28, 2004 1:59 pm 
Newbie

Joined: Thu Oct 28, 2004 1:33 pm
Posts: 14
Location: Stuttgart
Hibernate 2.1.6


MS SQL Server 2000


Hi there,
I'd like to ask for help to master concurrent access to SQL Server 2000 when updating records:

Inside a transaction, I need to update 5 records (representing steps in a workflow) in a multi user environment.

When using JDBC statements (i.e. without using the Hibernate library), I am setting an integer lock column in each record to "1" for all the records involved to notify other users not to modify them.

Therefore when using the Hibernate data aware class, I set the member field for the 5 class instances to "1", as well. But can please somebody help and tell me how to promote the information "lock column set to 1" to the SQL Server database while the transaction is running ?

Thanks for help,

Dirk V. Schesmer


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 28, 2004 3:48 pm 
Senior
Senior

Joined: Sun Jan 04, 2004 2:46 pm
Posts: 147
SQLServer 2000 should handle the locking for you. When you update a row in the database it will lock that row until you commit the transaction. To get concurreny working propertly you should implement one of the locking strategies that hibernate provides which will prevent users from overwriting each other's data. The <version> tag is the cleanest implementation.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 28, 2004 3:56 pm 
Newbie

Joined: Thu Oct 28, 2004 1:33 pm
Posts: 14
Location: Stuttgart
Thanks for replying, sounds like good news!
Do you mean I even do NOT need my lock column, but SQL Server 2000 will take car of locking. You know, SQL Server does not support things like "select for update" as Oracle does.

Dirk


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 28, 2004 9:31 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
If you stay within one transaction, your database should take care of isolationg the transactions. Make sure you have the proper transaction isolation mode set (google for it if you don't know what it means :) )


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 29, 2004 6:34 am 
Newbie

Joined: Fri Mar 26, 2004 8:51 am
Posts: 6
dschesmer wrote:
Thanks for replying, sounds like good news!
Do you mean I even do NOT need my lock column, but SQL Server 2000 will take car of locking. You know, SQL Server does not support things like "select for update" as Oracle does.

Dirk

uhh????? select * from xxx (UPDLOCK)


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.