-->
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: problem with optimistic lock and collections
PostPosted: Tue Aug 02, 2011 3:30 pm 
Newbie

Joined: Tue Aug 02, 2011 3:19 pm
Posts: 1
Hi all,

I have a problem using optimistic locking. I have a persistent object, with a version number. I want this version number to be increased only when my persistent object is 'really' updated, meaning when one or more fields have been modified or when a collection mapped in my entity with a @ManyToOne or @OneToMany annotation is modified in the database.
What happens is that the version is increased only when a field contained directly in my entity has changed, and not when a collection has changed.

Note : I put select-before-update in my Entity annotation. Don't know if it might changed the behaviour of the versioning on the collections!
I also have a field which should not influence the version in my entity, on which I put the @OptimisticLock(exclude=true) annotation.

Does anyone know how I may try to make my versioning work? According to what I've read on several forums, the version number should be automatically increased when a collection changed. Why wouldn't it be the case in my case? Any idea?

Thanks

Aurelia


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.