Hello everyone,
I have problem in trying to make delete orphans works.
The problem is that,
when i remove a child from a list, and save the parent,
the child is still in the database.
The code is like this :
Code:
Parent p = myDao.findParent(id);
p.getChildren().remove(0);
myDao.save(p);
This is the mapping.
Code:
<!-- in the parent class -->
<list name="children" inverse="false"
cascade="all,all-delete-orphan"
>
<key column="id_actionProg" ></key>
<list-index column="sortOrder" />
<one-to-many class="OperationProgrammee" />
</list>
I already use "all-delete-orphan" cascade style as suggested in the Hibernate documentation. "21. Example: Parent/Child".
http://docs.jboss.org/hibernate/stable/core/reference/en/html/example-parentchild-cascades.html.
This does not work.
Maybe this is because i use "inverse=false" or the collection is a list?
Please help me.
Thank you in advance.
regards,