-->
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.  [ 2 posts ] 
Author Message
 Post subject: Load Balanced HTTP/SOAP servers + Hibernate
PostPosted: Fri Feb 02, 2007 7:27 pm 
Newbie

Joined: Fri Feb 02, 2007 7:11 pm
Posts: 1
I'm trying to found out how hibernate deals with this situation.

2 + tomcat servers exporting the same interface via SOAP behind a load balanced switch.

First SOAP request comes in the row is pulled from the DB and a single column is changed, say column A1. The second SOAP request hits a different machine but pulls the same row and changes a different column, B1. They both commit but one the first update is lost.

Original row data is
A1 = 0
B1 = 1

First request gets the row, makes an object, sets the property, and commits it back
A1 = 1
B1 = 1

Second request is waiting on the lock, gets it and does an update with with original A1 val and its new B1 val.

A1 =0
B1 = 2

What we should have is A1=1 and B1= 2. I could write JDBC queries for this and just update the specific column. I can't really do too much locking because there are also thousands of simultaneous SELECT requests happening per second on the same data.

-Matt


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 02, 2007 9:49 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
You need to look at optimistic locking as this will provide the performance for reads (not locking the tables) and it will detect (and report) an update that would be an issue. See version tag in hibernate docs.


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