I am using latest version of hibernate.
I have many bags in my class.
Class A
bag b
bag c
bag d
When I save my object A, hibernate makes 4 SQL calls:
INSERT A
INSERT B
INSERT C
INSERT D
When I delete my object A, hibernate makes 4 SQL calls:
DELETE A
DELETE B
DELETE C
DELETE D
It should instead makes the calls in reverse order:
DELETE D
DELETE C
DELETE B
DELETE A
Actually, because it doesn't work this way, I have a lot of dependencies problems. I tried updating "Cascade.java" source file and now it works much better.
By the way I have the same issue when using subclass. The members of the subclass are first persited and then the members of the base class.
On save the based class should be persisted first, and on delete the child class should be deleted first.
Can someone tell me where I am wrong? I am surprise to have such an issue with hibernate because it appears to me to be a basic use of the ORM.
Regards.
|