-->
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: Running hibernate application in 2 JVM connected to the same
PostPosted: Thu Mar 30, 2006 10:49 am 
Newbie

Joined: Tue Mar 28, 2006 11:44 pm
Posts: 4
Hi All ,
I have a question /query regarding using the hibernate in th scenario described below.
We will be running our application behind a load ablancer, so 2 differnet JVM's would be running ,
and our application that is being developed using the hibernate will sit on both of these JVM's .
and the application would be using the same database.

So the query we have is since we have 2 differnet JVM's so will this be in any case become unstable
or the data would be inconsistent if the 2 users using the differnt JVM's try to access the same data in the database?

Thanks
Jyoti


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 30, 2006 11:39 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
You have to worry about stale data in that situation, yes. But it won't cause any data corruption, just potential data loss. If JVM A loads object X, JVM B loads object X, JVM A edits and saves object X, JVM B can still save object X, undoing JVM A's changes. It's the sort of thing that users just have to live with in multi-user environments.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 03, 2006 11:31 pm 
Newbie

Joined: Tue Mar 28, 2006 11:44 pm
Posts: 4
Hi All,,

I would like to reframe the same question once again for the better understanding.

1JVM A loads object X
2.JVM B loads object X
3.JVM B changes and saves object X
4.JVM A receives a request to load object X. Is there any chance that stale data will be loaded by JVM A since the hibernate engine thinks that Object X is not dirty and does not go to the DB to retrieve it (returns from its cache)?


Jyoti


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 04, 2006 12:09 am 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Yes, you have to worry about that. You can use session.refresh(), session.evict() or session.clear() any time you're concerned about finding stale data.


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.