title: NHibernate joining on incorrect field
body: <p>I am very new to Nhibernate, I know what my issue is however unsure how to fix it.</p>
  
  <p>Issue: The user is joined to a employee via the EmployeeID rather than the UserID. Which is causing issues as it is bringing back incorrect details. </p>
  
  <pre><code>Employee.hbm.xml
  &lt;many-to-one name="User" unique="true" column="UserID" /&gt;
  
  User.hbm.xml
  &lt;one-to-one name="Employee" foreign-key="EmployeeID" class="Employee" lazy="false" /&gt;
  
  Employee.cs
  public virtual int EmployeeID { get; set; }
  public virtual User User { get; set; } - This is UserID within the actual database
  public virtual string EmailAddress { get; set; }
  
  User.cs
  public virtual int UserID { get; set; }
  public virtual string Username { get; set; }
  public virtual string Title { get; set; }
  public virtual string Forename { get; set; }
  public virtual string Surname { get; set; }
  public virtual Employee Employee { get; set; }
  </code></pre>
  
  <p>Above is what someone else has coded and I'm trying to fix it. I tried changing </p>
  
  <pre><code>&lt;one-to-one name="Employee" foreign-key="UserID" class="Employee" lazy="false" /&gt;
  </code></pre>
  
  <p>however this still causes issues. </p>
  
  <p>Am I missing something? Thanks in advance for any help :-)</p>
  
  <p>Clare</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I was hoping by making it one-to-one that it would join on the UserID, however it is still joining on the EmployeeID. Anyone have any other ideas? Thanks again :-)</p>
  
  <pre><code>Employee.hbm.xml
  &lt;one-to-one name="User" foreign-key="UserID" class="User" lazy="false" /&gt;
  
  User.hbm.xml
  &lt;one-to-one name="Employee" foreign-key="UserID" class="Employee" lazy="false" /&gt;
  </code></pre>