-->
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: one database, two hibernates
PostPosted: Tue May 06, 2008 9:52 am 
Newbie

Joined: Sat Jul 21, 2007 7:46 am
Posts: 2
Hi everyone,
It's a quick question.

I was wondering. If I have one database, and two application servers, with one webapp on each. Let's call them webapp1 and webapp2. How will hibernate of webapp1 know that a webapp2 has modified or inserted data in the database ?

Thanks in advance


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 06, 2008 10:45 am 
Senior
Senior

Joined: Fri Jun 01, 2007 12:41 pm
Posts: 121
Hibernate determines this using Optimistic Concurrency Control (OCC) and Version checking/timestamp


Top
 Profile  
 
 Post subject: answer
PostPosted: Sun May 11, 2008 9:25 am 
Senior
Senior

Joined: Sun Jun 11, 2006 10:41 am
Posts: 164
It depends on how your entities are defined. I assume you use JPA because you talk about app severs? Well, if your entities use the @Version annotation, or the hbm equivalent, then regardless of who concurrently accesses the database (2 apps, 2 modules, 2 threads), only one of them will be able to update the entity, and the other will throw an OptimisticLockException or similar.


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.