Move from JIIRA(HHH-419):
relating to FAQ:
-Hibernate throws: Flush during cascade is dangerous(117.html#A26)
-When I delete an object that belongs to a cached collection(117.html#A33)
This was discussed many times in forums and FAQ, but please have a look at my case.
Entity Parent has one-to-many(cascade<>none) with entity Child
parent=load();
child = parent.getChildren().get(0);
//other process...
//in another method or layer
delete(child); //throw ObjectDeletedException
Because delete(child) is called in a seperate method/layer, where developer does not know anything about entity parent,
so I cannot remove from set children to avoid this exception.
I think hibernate have enough metadata to remove child from set children automatically, developer doesn't have to care about this.
In fact, if hibernate do not support this feature, i have to give up cascading feature in my project.
(I love cascading feature so much!)
|