-->
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: Update object attribute from another object's prepersist
PostPosted: Fri Sep 12, 2008 6:32 am 
Newbie

Joined: Fri Sep 12, 2008 5:40 am
Posts: 4
Hi,

For some reasons, in our system, we'll have to update the version number of a parent object whenever its child object is being updated. (they're having OneToMany relationship and cascade all)

We have created an unit test which updates one of the attributes of the parent object in the prepersist callback of the child object. Hibernate looks working fine with our desired results.

However, we would like to know if it's appropriate to make an object dirty in the prepersist callback of another object. Also, does hibernate defined any update order of such kind of parent/child object?

Note:

We do not need this trick in hibernate 3.2.6 ga (hibernate will update the version number of parent object when the child is updated), however, we found that the behavior is changed in version 3.4.0 sp1.

Thanks,
ALan


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.