-->
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: Midair Collision detection
PostPosted: Tue Nov 01, 2005 5:34 am 
Beginner
Beginner

Joined: Wed Aug 04, 2004 4:33 am
Posts: 45
Location: Switzerland
Hibernate version: 2.1.8

Hi all.

Is there an easy way to make hibernate check for midaircollisions? I mean that while I'm editing an object another one updates it. So I should not be able to save my changes, since it would overwrite the changes of the other user.

I have a modifiedDate field on the object which could be compared at save time to check whether there was an update in between.

Thanks a lot!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 01, 2005 12:50 pm 
Beginner
Beginner

Joined: Mon Aug 16, 2004 6:15 am
Posts: 24
What you're looking for is optimistic locking, have a look in the docs about the version property http://www.hibernate.org/hib_docs/reference/en/html/mapping.html#mapping-declaration-version
or the timestamp property http://www.hibernate.org/hib_docs/reference/en/html/mapping.html#mapping-declaration-timestamp


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 02, 2005 5:34 am 
Beginner
Beginner

Joined: Wed Aug 04, 2004 4:33 am
Posts: 45
Location: Switzerland
thanks.

Unfortunately this doesn't work, because the version attribute is part of a component. I wasn't able to map this.

What I did now, is an Interceptor which checks this. But the optimistic locking would for sure have been better.


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.