Here is what I am trying.
Grandparent gp = (Grandparent)session.load(Grandparent.class, pid);
Set <Parent> p = gp.getParent();
Set <Child> c = p.getChildren();
//This works, and removes specified children from database
p.getChildren().remove(0); //With iterator
p.getChildren().remove(1); //With iterator
session.update(gp);
//This does not remove any parent from the database
gp.getParent().remove(0); //With iterator
gp.getParent().remove(1); //With iterator
session.update(gp);
So my only confusion is, if removing children from parent causes hibernate to delete children, why not removing the parent from grandparent cause hibernate to delete parent?
|