title: Fluent NHibernate and HasMany mapping
body: <p>I have following problem using fluent nhibernate and HasMany. I've search through google and SO for similar problem but any of solutions I've found does not solve my problem.</p>
  
  <p>I have following entites mapped (I omitted most properties for clarity):</p>
  
  <p>PaymentSchedule.cs</p>
  
  <pre><code>public class PaymentSchedule
  {
      public virtual BinaryId Id { get; set; }
  
      public virtual IList&lt;PaymentToSchedule&gt; Payments { get; set; }
  }
  </code></pre>
  
  <p>PaymentToSchedule.cs</p>
  
  <pre><code>  public class PaymentToSchedule
    {
      public virtual BinaryId Id { get; set; }        
  
      public virtual PaymentSchedule PaymentSchedule { get; set; }
  }
  </code></pre>
  
  <p>Mapping files</p>
  
  <p>PaymentScheduleMap.cs</p>
  
  <pre><code>public class PaymentScheduleMap : ClassMap&lt;PaymentSchedule&gt;
  {
      public PaymentScheduleMap()
      {
          Table("A_Payment_Schedule");
          Id(x =&gt; x.Id, "A_Payment_Schedule_Id").CrmId();
          HasMany&lt;PaymentToSchedule&gt;(x =&gt; x.Payments).Table("A_Payment_To_Schedule").KeyColumns.Add("A_Payment_Schedule_Id").Fetch.Select();
      }
  }
  </code></pre>
  
  <p>PaymentToScheduleMap.cs</p>
  
  <pre><code>public class PaymentToScheduleMap : ClassMap&lt;PaymentToSchedule&gt;
  {
      public PaymentToScheduleMap()
      {
          Table("A_Payment_To_Schedule");
          Id(x =&gt; x.Id, "A_Payment_To_Schedule_Id").CrmId();            
          References(x =&gt; x.PaymentSchedule, "A_Payment_Schedule_Id");            
      }
  }
  </code></pre>
  
  <p>Basically I want to fetch list of PaymentToSchedule entites when loading PaymentSchedule object. Now, to do this, I must use such queries:</p>
  
  <pre><code>var paymentSchedules = dataAccess.Session.QueryOver&lt;PaymentSchedule&gt;().List(); 
  </code></pre>
  
  <p>and for each of the payment schedule</p>
  
  <pre><code> var paymentToSchedule = (from pts in dataAccess.Session.Query&lt;PaymentToSchedule&gt;()
                                                  where pts.PaymentSchedule.Id == ps.Id).
                                                        ToList&lt;PaymentToSchedule&gt;();
  </code></pre>
  
  <p>This works fine, but is there a way to fetch list of PaymentToSchedule entites while querying PaymentSchedule?</p>