-->
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.  [ 1 post ] 
Author Message
 Post subject: Hibernate optimistic Concurrency Issue
PostPosted: Mon Dec 09, 2013 3:40 pm 
Newbie

Joined: Mon Dec 09, 2013 3:25 pm
Posts: 1
Hello,
We are using hibernate for a J2EE application,where we are updating multiple rows which could be shared other user.For example two user, user1 and user 2 read same 5 rows and displayed on User Interface. user1 and user2 selects same rows and try to update them in Database. How can we avoid one user updating the updates of other.

I can think of option below:

Option: while updating we will first fetch specific row as a persistant object (mark it as @version) in a hibernate transaction and update the same row using the same transaction. when other user tries to update the same he would check the @version value if it not matching, will throw exception.

Is this is the only way we can achieve optimistic concurrency or if there are other ways. Please suggest with sample code if possible.

Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.