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
|