Hi,
I have a Parent class which has a one-to-many Set of Children defined in the hbm file. In the hbm file of the Child, there is NO many-to-one relationship, as I don't have the need for a bi-directional relationship.
In the (Oracle) database, the child table has a not-null foreign key to the parent table, along with a cascading delete constraint (when parent is deleted, all childs will also be deleted). Therefore, I don't need the "cascade" setting in the Hibernate files.
Now, if I try session.delete(Parent), Hibernate tries to update the foreign key field of all children records to null. Of course this fails due to the not-null constraint on the child table. Now, how can I (WITHOUT setting a bi-directional relationship) actually delete the parent record, without Hibernate attempting to do the previously mentioned update of the children records? Deletion of the parent record would suffice, as the cascading delete on the children record will make sure they disappear also...
Thanks
Kind regards
Johan
|