Take the 2-minute tour ×

In my project i m using using hibernate and oracle as DB.

I am having two tables with foreign key relationship.

In hibernate I m have one-to-many relationship.

my one-to-many code

set name="classname" cascade="all,all-delete-orphan

one-to-many ..... on-delete="cascade"


But whenever i detele i am getting constraint violation error... ora:222 error cannot delete it has child table I have cascade="all" but y still the error comes...

Same error while inserting too. I am having primarykey as ID attribute which is sequence. So in foreignkey ID attribute its not inserting and getting null cannot be inserted error .. Have any one experienced these errors ?

share|improve this question
add comment

1 Answer





instead of:


Also, make sure you mark one side of the association with:


if the association is bi-directional.

If that doesn't solve your issue, please try to clean up your explanation a little and provide more information (like the full mapping files and Java classes for the two objects involved).

share|improve this answer
add comment

Your Answer


