title: NHibernate Cascade Delete on children when clearing a collection
body: <p>I've searched so many places and still can't find the a answer I'm looking for.</p>
  
  <p>I'm using NHibernate 3.2 - Mapping by Code</p>
  
  <p>I Have the following Mapping files:</p>
  
  <pre><code>public class ParentMapping: EntityMapping&lt;Parent&gt;
  {
          public ParentMapping()
          {
              Set(x =&gt; x.Children, map =&gt;
                                             {
                                                 map.Cascade(Cascade.All);
                                                 map.Inverse(true);
                                             }, r =&gt; r.OneToMany());
          }
  }
  
  public class ChildMapping: JoinedSubclassMapping&lt;Child&gt; // This is a subclass of something else.
  {
          public RequiredSkillMapping()
          {
              ManyToOne(x =&gt; x.Parent, map =&gt; { map.NotNullable(true); });
          }
  }
  </code></pre>
  
  <p>The cascade save works fine.</p>
  
  <pre><code>session.Save(parent) will save the children and associate them correctly.
  </code></pre>
  
  <p>When I try to call:</p>
  
  <pre><code>var parent = session.Get&lt;Parent&gt;(1);
  parent.Children.Clear();
  
  session.Save(parent); or session.SaveOrUpdate(parent) or session.Update(parent)
  </code></pre>
  
  <p>The entities stay associated to the parent.</p>
  
  <p>I had it working by calling:</p>
  
  <pre><code>foreach(var child in parent.Children)
  {
  session.Delete(child);
  }
  
  parent.Children.Clear();
  </code></pre>
  
  <p>I was hoping that there would be a way to just save the parent?</p>
  
  <p>Cheers,</p>
  
  <p>James</p>