title: NHibernate returning duplicate rows
body: <p>NHibernate appears to be returning the contents of the first row multiple times. As many times as there are actual, distinct rows in the database. For example, if one person has 3 campus affiliations like this:</p>
  
  <p>Baker College       -  Teacher<br>
  Bryant Elementary   - Teacher<br>
  Ohio State University - Student</p>
  
  <p>NHibernate will return it like this:</p>
  
  <p>Baker College    -     Teacher<br>
  Baker College    -     Teacher<br>
  Baker College    -     Teacher  </p>
  
  <p>I'm using FluentNHibernate. Here are some snippets of the entity and mapping files:</p>
  
  <pre><code>public class Person
  {
      public virtual string SysID { get; set; }
      public virtual string FullName { get; set; }
      public virtual ICollection&lt;Campus&gt; Campuses { get; set; }
  }
  
  public class Campus
  {
      public virtual string SysID { get; set; }
      public virtual string Name { get; set; }
      public virtual string Affiliation { get; set; }
  }
  
  public class PersonMapping
  {
      Table("Person");
      Id(x =&gt; x.SysId);
      Map(x =&gt; x.FullName).Column("FULL_NAME");
      HasMany(x =&gt; x.Campuses).KeyColumn("SysId");
  }
  
  public class CampusMapping
  {
      Table("Campus");
      Id(x =&gt; x.SysID);
      Map(x =&gt; x.Name);
      Map(x =&gt; x.Affiliation);
  }
  </code></pre>
  
  <p>I'm iterating through the campuses in my view (MVC 3) like this:</p>
  
  <pre><code>@foreach(var campus in Model.Campuses)
  {
      @campus.Name @campus.Affiliation
  }
  </code></pre>
  
  <p>I also tried adding this to the entity to make sure it wasn't a silly mistake with MVC or Razor and had the same result:</p>
  
  <pre><code>public virtual string campusesToString
  {
      get
      {
          string s = "";
  
          for (int i = 0; i &lt; Campuses.Count; i++)
          {
              s = s + Campuses.ElementAt(i).Name + " ";
          }
  
          return s;
      }
  }
  </code></pre>
  
  <p>Finally, I checked the SQL that was being output, and it's correct, and it's returning all of the rows uniquely...</p>