Hi, I have a parent child relationship.
In parent.hbm.xml
<set name="child" lazy="true" cascade="all, delete-orphan" table="child_table"> <key column="parent_id" /> <one-to-many class="Child" /> </set>
I Child.hbm.xml
<many-to-one name="toParent" class="Parent" column="parent_id" />
The problem is that after updating parent with some code like this one:
Parent p = new Parent(); Set foo = new Hashset(); foo.add(new Child()); p.setChilds(foo);
I dont get old childs before this update deleted from child database table. I know it is a basic question, but even reading the hibernate documentation I cannot figure it out how to get this basic operation done.
|