title: NHibernate: Want to change insert/update behavior of <idbag>
body: <p>I have a class A containing a list of B mapped like that</p>
  
  <pre><code>&lt;class name="A" table="CLASS_A"&gt;
      ...
      &lt;idbag name="ListOfB"
             table="CLASS_A_CLASS_B"
             cascade="save-update"&gt;
        &lt;collection-id column="ID" type="Guid"&gt;   &lt;!-- surrogate key --&gt;
          &lt;generator class="guid.comb"/&gt;
        &lt;/collection-id&gt;
        &lt;key column="ID_A"/&gt;
        &lt;many-to-many column="ID_B" class="B"/&gt;
      &lt;/idbag&gt;
  &lt;/class&gt;
  </code></pre>
  
  <p>On the DB side, there's a many-to-many join CLASS_A_CLASS_B table between CLASS_A &amp; CLASS_B tables and it's got an ID surrogate key. The many-to-many relation is not mapped in the object model of class B.</p>
  
  <p>Initially, let's say I have object X1 and X2 in ListOfB. If I remove X2 and insert X3, I noticed that NHibernate will do an update of the foreign key pointing to X2 to make it point to X3. </p>
  
  <p>This is a fine optimization. </p>
  
  <p>For my purpose however, I would like to trick NHibernate into doing a delete followed by a new insertion in the M2M join table (delete row for X2, insert new row for X3). I want that since these tables are replicated to another instance of our application and we show a diff of insert/update/delete to the user. </p>
  
  <p>In this particular case, the use case is really "I removed X2 and added X3", so I'd like the diff the show that fact (instead of an update). I understand this behavior is suboptimal but it does not matter in this case.</p>
  
  <p>Any way to trick NHibernate into doing that ?</p>