title: nHibernate Cascade AllDeleteOrphan: Why is NH deleting each collection item individually
body: <p>When I'm clearing a childcollection like this</p>
  
  <pre><code>table.Indizes.Clear();
  session.Flush();
  </code></pre>
  
  <p>then NH generates a delete SQL for each item which was in the collection:</p>
  
  <p>DELETE FROM x_inddef WHERE ind_name = 'IDX_ADRKONZ_CODE' AND tbl_name = 'ADRESSE' 
     DELETE FROM x_inddef WHERE ind_name = 'IDX_ADRKUND_EXT' AND tbl_name = 'ADRESSE' </p>
  
  <p>...</p>
  
  <p>Why isn't it generating a statement like this?</p>
  
  <pre><code>DELETE FROM x_inddef WHERE tbl_name = 'ADRESSE'
  </code></pre>
  
  <p>Is something wrong with my mappings, or is this just the normal behaviour?</p>
  
  <p>Simplified Code with the fluent Mapping:</p>
  
  <pre><code>public class Table
  {
      public virtual string Name {get;set;
      public virtual IList&lt;Index&gt; Indizes { get; set; }
  }
  
  public class TableOverride : IAutoMappingOverride&lt;Table&gt;
  {
      public void Override(AutoMapping&lt;Table&gt; mapping)
      {
          mapping.Table("x_tables");
          mapping.Id(x =&gt; x.Name, "tbl_name");
          mapping.HasMany(x =&gt; x.Indizes).KeyColumn("tbl_name").Inverse().Cascade.AllDeleteOrphan();
      }
  }
  
  public class Index
  {
      public virtual string Name { get; set; }
      public virtual Table Table { get; set; }
  
      public override bool Equals(object obj)
      {
          //...
      }
  
      public override int GetHashCode()
      {
          //...
      }
  }
  
  public class IndexOverride : IAutoMappingOverride&lt;Index&gt;
  {
      public void Override(AutoMapping&lt;Index&gt; mapping)
      {
          mapping.Table("x_inddef");
          mapping.CompositeId().
              KeyProperty(x =&gt; x.Name, "ind_name").
              KeyReference(x =&gt; x.Table, "tbl_name");
      }
  }
  </code></pre>