Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

hibernate child cascade delete child???

843838Jan 3 2006 — edited Sep 5 2008
i 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 3 2008
Added on Jan 3 2006
6 comments
1,992 views