Reputation: 1862
I've seen this question asked here but I haven't found one that is answered correctly. I have a many-to-many mapping with these tables:
Collection
Items
Collection_Items
A Collection has many Items and an item can belong to many Collections. Collection_Items is the joining table.
If (using nHibernate) I want to delete an Item or Collection and have it delete it's joining associations without also deleting it's children... how do I do that?
If you have an example it doesn't matter if it's XML or Fluent or attributes or whatever.
Also, I have foreign key constraints connecting the two tables to the joining table.
Any examples out there?
Thanks!
Upvotes: 4
Views: 1307
Reputation: 1862
It turns out I just needed CascaseStyle.None on both side and to remove the Inverse = True from the Items side. Turns out this is a very simple mapping.
Upvotes: 7