-->
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: version field of child object not refreshed
PostPosted: Fri Jan 12, 2007 4:45 am 
Beginner
Beginner

Joined: Tue Oct 18, 2005 3:44 am
Posts: 27
Hey,

When I save a parent object (with cascade=all for the child object), the version field of the child object is incremented in the database, but not in my object.
So when I try to save the child object again, I receive a StaleObjectStateException.
How to fix it?

Thanks
Cathy


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 15, 2007 2:57 am 
Beginner
Beginner

Joined: Tue Oct 18, 2005 3:44 am
Posts: 27
No body knows about it?
Perhaps is my question not understandable.
Here an example :

child.save() => version of child = 0 in object and database
child.update() => version of child = 1 in object and database
parent.setChild(child) => version of parent = 0 in object and database
but the version of child = 2 in database and stay = 1 in object
so the next time I do child.update() I receive a StaleObjectStateException.

I tried to flush after each update/save but it doesn't change anything.

Thanks fo your help.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 15, 2007 3:52 am 
Newbie

Joined: Tue Dec 19, 2006 11:05 am
Posts: 11
May you mapped the parent.childs property with optimistic-lock=false? This would prevent the version increment...


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.