Hello!
I have a many-to-one relationship set within the same table:
Code:
<set name="childActivities"
table="activities"
inverse="true" lazy="true">
<key column="parentActivityId"/>
<one-to-many class="ar.com.test.domain.Activity"/>
</set>
<many-to-one name="parentActivity" class="ar.com.test.domain.Activity" column="parentActivityId" />
The problem is that if i try to delete two rows from the table that are parent and child i get an error due to the foreign key constraint, at first i thought i could go around this by deleting the child first but i was not able to enforce an order of deletion after removing the entities from the collections.
Is there a way to solve this? (I cant shake the feeling that i am doing something basic in the wrong way, i should point out that i am far from being an expert in Hibernate)
Thanks in advance!