title: NHibernate many-to-one relationship deleting parent only
body: <p>I have a many-to-one relationship between objects <code>Product</code> and <code>Supplier</code>. I need to be able to delete <code>Supplier</code> without deleting the <code>Product</code>s that belong to it.</p>
  
  <p>Here is a simplified version of classes:</p>
  
  <pre><code>public class Supplier {
      public virtual IList&lt;Product&gt; Products { get; protected set; }
  }
  
  public class Product {
      // Product belongs to a Category but Supplier is optional
      public virtual Supplier Supplier { get; set; }
      public virtual Category Category { get; set; }
  }
  </code></pre>
  
  <p>I'm using FluentNHibernate, but here are the mappings it produces:</p>
  
  <pre><code>&lt;bag name="Products" cascade="save-update" inverse="true"&gt;
        &lt;key column="SupplierID" /&gt;
        &lt;one-to-many class="Me.Product, Me, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" /&gt;
  &lt;/bag&gt;
  
  &lt;many-to-one name="Supplier" column="SupplierID" /&gt;
  </code></pre>
  
  <p>This creates a foreign key on the Products table, so when I attempt to do a straight delete on a Supplier I get a foreign key constraint error. I tried changing cascade to 'all', in the hope that it might only delete the relationship, but it deleted all Products and their other associated objects.</p>
  
  <p>The only way I can see to solve this right now is to iterate the Products collection of Supplier and set the Supplier property to null. Is there a way I can achieve this behaviour through the mapping?</p>