-->
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.  [ 3 posts ] 
Author Message
 Post subject: Multiple clients using same database server
PostPosted: Fri Aug 29, 2003 1:32 pm 
Newbie

Joined: Fri Aug 29, 2003 1:18 pm
Posts: 13
Location: Vitoria, ES - Brazil
Hi,

I've read Hibernate reference, but I'm still confused over this issue. Say I have many client machines running a software that I developed using Hibernate and all of them use the same database server.

What's the best way to avoid concurrency problems, such as one of the clients working with stale data because another one changed it?

If I use the .reconnect() approach (13.3.1 on the reference doc), does Hibernate guarantee that the data is not stale or do I have to use session.lock() (13.4 on the reference doc)?

Thanks for any pointers in this matter.

V


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 29, 2003 4:04 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
As long as you use versioned data, Hibernate will handle optimistic locking automatically.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 29, 2003 4:05 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
The documentation covers this pretty well. Check out http://www.hibernate.org/hib_docs/reference/html/transactions.html#transactions-s3

>> does Hibernate guarantee that the data is not stale...
If you use session.disconnect()/reconnect() the data actually has a much higher chance of being stale. Therefore, if you use this approach, you should use session.lock() prior to attempting to update it to ensure that it has not changed.

The easiest plan of action is to utilize one of the versioning techniques outlined in the documentation.


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