-->
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: Handling concurrency issues with web apps
PostPosted: Mon Feb 07, 2005 12:21 pm 
Beginner
Beginner

Joined: Tue Nov 02, 2004 1:34 pm
Posts: 45
Ok...here's a general development issue that conerns any web based app that is data entry oriented. I've been doing reporting systems so long, I've gotten a bit rusty with transactional development.

What's the best strategy for avoiding "last save wins" concurrency issues? If two people open a web maintenance page, change data, and save, the "last saved" wins, meaning the person who saved first loses their changes.

In the client server world, we'd simply lock the record when someone opened the screen....but you can't do that in a stateless web environment. How would you know the client logged off (or simply closed their browser)? The record could remain locked forever....not to mention you are using shared connections and only the "app server" has an account with the database.

Right now I have a plan for keeping a field with a "count"...that gets incremented when someone saves a change. But before a save occurs, the count is checked, and if it's not the same as when you opened the page, that means someone else has saved in the mean time, and you can inform the user that they need to refresh, and remake their changes.

Any better plan than this?

Lee


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 07, 2005 12:42 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Use optimistic locking (version/timestamp)


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.