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.  [ 1 post ] 
Author Message
 Post subject: Can I set optimistic-lock="true|false" using annotations ?
PostPosted: Mon May 10, 2010 5:06 pm 
Beginner
Beginner

Joined: Thu Jun 21, 2007 1:47 pm
Posts: 46
I've been getting spurious OptimisticLockException / StaleObjectStateException and finally, after much digging, I found that hibernate actually bumps the version number of the parent object if one of its collections is modified.

For almost all of my collections this is not desirable, and I'd be happy to turn this feature off completely if possible.

I notice that if I use an hbm.xml file I can set an attribute optimistic-lock="true|false" (this setting was one of two clues I found indicating that changes to collections bumps the version on the parent entity). However, I haven't found its equivalent in annotations.

Is there one?

What if I just delete the collection completely and use queries to fetch the child objects when I need them?

Thanks ...

Dobes


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.