-->
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: Prevent inconsistencies
PostPosted: Thu Sep 16, 2010 4:45 am 
Newbie

Joined: Thu Sep 16, 2010 4:39 am
Posts: 3
Hello, I'm new to hibernate so forgive me for a stupid question.

let's say I have 3 computers, Alice, Bob and Clare.

A mysql database is on Clare, containing my tables and data, of course both Alice and Bob can connect to the database.

I've developed a small Java application that runs both on Alice and Bob and uses hibernate to read and write data to Clare.
The problem is that Alice can read something (say, a "Client") and she can modify it through her GUI while, at the same time, Bob can hit the "delete client" button in his GUI. As soon as he deletes the object, it is removed from his cache and from Clare. Alice, anyway, still sees that client in her GUI and keeps handling and modifying it, then saving to the database something that has been deleted by Bob.

How can I cope with this situation? How can I prevent Bob from altering something that, potentially, Alice is altering too?

Thanks for your time.


Top
 Profile  
 
 Post subject: Re: Prevent inconsistencies
PostPosted: Mon Sep 20, 2010 5:05 am 
Newbie

Joined: Thu Sep 16, 2010 4:39 am
Posts: 3
up?


Top
 Profile  
 
 Post subject: Re: Prevent inconsistencies
PostPosted: Mon Sep 20, 2010 6:51 am 
Senior
Senior

Joined: Tue Oct 28, 2008 10:39 am
Posts: 196
You are looking for optimistic locking.


Top
 Profile  
 
 Post subject: Re: Prevent inconsistencies
PostPosted: Mon Sep 20, 2010 6:56 am 
Newbie

Joined: Thu Sep 16, 2010 4:39 am
Posts: 3
Thanks for the directions.

I'll dig into that.


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.