-->
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.  [ 4 posts ] 
Author Message
 Post subject: Concurrency problem with modifying same DO in diff. threads
PostPosted: Mon Sep 13, 2004 1:19 pm 
Newbie

Joined: Mon Sep 13, 2004 1:06 pm
Posts: 2
Hibernate version:
2.0.3

Name and version of the database you are using:
MySQL 4.2

HI,

I've got a concurrency problem when I am modifying same DO in diff. threads with different hibernate session. Basically, both threads have their own hibernate session, both thread may update the DO based on the current state of the DO. However, when both threads loaded to objects, and one thread has commited the change, the other thread cannot get the latest DO state anymore (Because of the object already loaded to session cache).

What should be the proper way to handle this concurrency problem? Application Locking Mechanism? Refresh the object everytime I want to get the latest state of the object?...

Many Thanks,
Germen


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 13, 2004 1:25 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I use version optimistic locking managed by Hibernate (not your app)

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 13, 2004 10:55 pm 
Newbie

Joined: Mon Sep 13, 2004 1:06 pm
Posts: 2
Do u mean when the version optimistic lock is enabled, the hibernate session will automatically refresh the committed changes of the other session? If yes that's really nice feature...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 04, 2004 4:56 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
No there is no solution for that, since it is inconsistent.
But Hibernate will warn you if your data has been updated behind your back (through a StaleObjectException)

_________________
Emmanuel


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