nhibernate - Many-to-Many Cascading Delete -


I have defined many relationships between the two classes. Event and person (defined in a separate database table person_event) Now, suppose I want to delete a person, so all the relevant organizations with the event should also be removed from person_ event table. In other words, I want Caspad on Delight.

Consider a scenario:

  • There are three events identified by ID = 1, 2, 3 in the "Events" table.
  • The "person" table includes two people identified by id = 4, 5.
  • "person_exchange" table with associations like 1-4, 2-4, 3-5

Now, suppose I used HibernateEdit () Delete event 1, then not only removes this event 1, and the Association person_event1-4, but the person 4!

The problem is 4 is referenced by another tables and it throws an exotic barrier exception ... How could I configure NHibernate to destroy only event and organization person_event?

I think if you set the Cascade setting on many for many maps, then you You should be able to get it.

This is not the only event related to the event, but the impact of the person being removed does not cascade.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -