hibernate child cascade delete child???
843838Jan 3 2006 — edited Sep 5 2008i am facing a problem on the cascade delete of a parent object, i try to explain the problem by example.
Parent object C
Child object D,E,F
i want to delete the parent object "delete(c) ".
before the parent can be deleted the child D,E and F has to be deleted.
My relations are defined with cascade="all-delete-orphan" in the parent
object. In my child no cascade is defined.
When i check the logging on deletion of the object i see that hibernate
tries to update reference in the child to the parent by setting the value to
null. But since the the reference is obligated (NOT NULL in database)
i get a not null constraint violation.
My first question is why does hibernate not delete the child record instead of updating the reference (since my child object is remove
from my collection in the parent object)?
Could some one tell me what i am doing wrong? or does there not exist a solution.
thnx