title: NHibernate one-to-one mapping, non-primary keys
body: <p>Can't get NHibernate to generate the correct query. It keeps using the primary keys of the two tables I'm joining for the one-to-one relationship, and I can't figure out how to specify the foreign key in one of the tables.</p>
  
  <pre><code>tableA      tableB
  { aID,      { bID,
    bID,        z,
    c,          y,
    d }         x }
  </code></pre>
  
  <p>so the tableA should join to tableB using tableA.bID = tableB.bID. How can I specify this in the mapping for tableA? I'm using the tableA class to retrieve a row from tableA and a row from tableB, as it is a real one to one relationship.</p>
  
  <p>NHibernate generates the sql to join the tables using tableA.aID = tableB.bID, which is wrong. </p>
  
  <p>This does not work:</p>
  
  <pre><code>&lt;class name="tableA" table="tableA"&gt;
    &lt;id name="aID" column="aID" /&gt;
    &lt;property name="bID" column="bID" /&gt;
    &lt;property name="c" column="c" /&gt;
    &lt;property name="d" column="d" /&gt;
    &lt;one-to-one name="otherThing" class="tableB" foreign-key="bID" /&gt;
  &lt;/class&gt;
  
  &lt;class name="tableB" table="tableB"&gt;
    &lt;id name="bID" column="bID" /&gt;
    &lt;property name="z" column="z" /&gt;
    &lt;property name="y" column="y" /&gt;
    &lt;property name="x" column="x" /&gt;
  &lt;/class&gt;
  </code></pre>