Reputation: 14054
Lets say you have two classes, Boss and Employee.
There is a bidirectional many-to-many relationship(using a join table) between Boss and Employee, where Boss is the owner of the relationship.
If I load a instance of Employee, I'm not allowed to delete it, due to the foreign key in the join table, which makes sense.
Now, I can manually loop through the Boss collection of the Employee instance, and remove the employee instance (which is to be deleted) from the relevant collection in each of the Boss instances. But, I was wondering, is there any way to cascade this? So, if I delete the Employee instance, it will automatically remove the entry in the join table, but not actually delete the Boss instances.
-Daniel
Upvotes: 0
Views: 103
Reputation: 15316
Nope, you can persist changes only from the Owner side:
Changes made only to the inverse end of the association are not persisted.
Taken from here
Upvotes: 3