title: Fluent NHibernate: Getting a "could not initialize collection" error while debugging an NUnit test in SharpDevelop
body: <p>I am getting the following error when attempting to work with an unremarkable object with a collection of other objects as a member when using NHibernate as my ORM tool. When the top-level object doesn't have any objects in said collection I am getting an error like "Could not initialize a collection: (a ton of SQL)". I know that the table it is referencing is empty as should be the collection, but NHibernate seems to be attempting to fill it an is then throwing an exception because there is no data. </p>
  
  <p>I would expect the collection to simply be null or empty rather than halting the execution of the program, this looks like an NHibernate error to me, but it is possible I improperly wrapped the ORM objects etc. as I am relatively new to the technology. My mapping is attached below. The _holdings collection is what is throwing the error.</p>
  
  <pre><code>public class FundMap : ClassMap&lt;Fund&gt;
  {
      public FundMap() 
      {
          Id(x =&gt; x._fundID).GeneratedBy.Identity();
          Map(x =&gt; x._cik);
          Map(x =&gt; x._fundName);
          //TODO: get correct handling of HasMany relationships.
          HasMany(x =&gt; x._holdings)
              //.Inverse()
              .Cascade.All();
              //.Cascade.None();
      }
  }
  </code></pre>