title: NHibernate - how to configure associations not to use primary key
body: <p>I'm working with a legacy database put together by some very strange people. I'm writing an NHibernate DAL over the top of it but running into some odd mapping scenarios.</p>
  
  <p>In one example, I have a table with a number of fields including <code>LE_RECNUM</code> (integer primary key) and <code>LE_CODE</code> (string).</p>
  
  <p>However, all relationships throughout the database join onto <code>LE_CODE</code>, not <code>LE_RECNUM</code>, for some unfathomable reason.</p>
  
  <p>I need to specify that <code>LE_RECNUM</code> is the Id in my mapping file, because I need the primary key to be generated when I insert records. However, I want all associations to use <code>LE_CODE</code> instead of <code>LE_RECNUM</code>.</p>
  
  <p>Can anyone suggest how I might do this?</p>