I am using NHibernate for DB connection for the following classes:
Class A
{
public int Id{get;set;}
public List<B> InnerElements{get;set;}
}
Class B
{
public int Id{get;set;}
public string Description{get;set;}
...no reference to the parent
}
and in the DB i have As (to class A), Bs(to class b) and ABs tables where the table ABs has an autoincremented id, and the ids of A and B entities.
The configuration files for the classes are:
Class A
...other properties mapped
<bag name="InnerElements" table="ABs" cascade="all" inverse="true">
<key column="AID" />
<many-to-many class="B" column="BID"/>
</bag>
and in the class B i dont have any refferences to class A.
When I remove an B element from the InnerElements from an entity of type A, and try to Save/Update the modified entity back to the DB, the inner ABs table remains unmodified. How can I change (in the config files or otherwise) to remove the entry from the inner table ? I dont want to remove any A or B entry from DB.
Thanks in advance, Tamash