-->
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: Simple problem - i've probably misunderstood semantics?
PostPosted: Tue Jul 18, 2006 11:39 am 
Newbie

Joined: Fri Feb 10, 2006 6:02 am
Posts: 15
If someone can point me in the right direction I would be very appreciative.

@Version not working as I expected with cascade saving.

I have 2 classes: PARENT_CLASS and CHILD_CLASS.

PARENT_CLASS contains a set of CHILD_CLASS.

Both class PARENT_CLASS and CHILD_CLASS have a field annotated @Version.

If I call merge() on either PARENT_CLASS or CHILD_CLASS their respective version number is incremented.

However, if I add a new instance of CHILD_CLASS as a child to an instance of PARENT_CLASS and then call merge() on parent instance, the version number for the PARENT_CLASS is incremented, but the CHILD_CLASS version is inserted into the database as 0 when the merge is cascaded to the child.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 18, 2006 2:01 pm 
Newbie

Joined: Tue Jul 18, 2006 1:17 pm
Posts: 8
isn't it the 0'th version when it's new?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 19, 2006 3:41 am 
Newbie

Joined: Fri Feb 10, 2006 6:02 am
Posts: 15
The child has a version == 0 when it is first created on the client before being saved to the database. This should be incremented before being inserted to the DB. This is what happens if i directly call merge() on the child. It is only when the merge cascades from the parent to the child that I get a version of 0 for the child in the database,


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.