Hibernate version:2.1.7c
Hi everybody,
I have a question regarding cascade=all-delete-orphan
I have a parent/child association that uses cascade=all-delete-orphan.
The child has a column (different from the PK) that has a UNIQUE constraint.
If I remove some children from the parent, add new ones, and save: all children are passed to saveOrUpdate, and the ones that were removed are deleted.
This is what I expected.
Now, if I :
- remove a child
- add a new one with the same unique property as the one I have deleted
- pass the parent to saveOrUpdate
The new child is created before the old one is deleted, causing a 'unique constraint violation'.
Is there a way to make sure the chidren that I removed are deleted before the ones I added are created?
Thanks you,
Susie.
|