title: Include primary key of reference table in model using NHibernate
body: <p>We are using NHibernate for DB operations and in our database there is a reference of <code>Organisation</code> in the <code>Configuration</code> table. This is existing code and cannot be changed.</p>
  <p>Configuration table is heavily used throughout application so we want to include the <code>OrganisationId</code> in the <code>Configuration</code> model class, but not in table as it already has reference object. By doing this we will avoid loading whole organisation object when we just need <code>OrganisationId</code>.</p>
  <pre><code>//Configuration.hbm.xml
  &lt;many-to-one name=&quot;Organisation&quot;
                   class=&quot;Organisation&quot;
                   not-null=&quot;false&quot;
           foreign-key=&quot;FK_ConfigurationItem_Organisation&quot;
           unique-key=&quot;UniqueConfigurationItemName&quot;/&gt;
  
  //Configuration.cs  (Model Class)
  public virtual Organisation Organisation { get; set; }
  </code></pre>
  <p>How do I modify hbm or model class so that we get <code>organisationId</code> without including this field in table?</p>
  <p>I am new to NHibernate and stuck with this requirement.</p>
  <p>Any suggestion will be appreciated.
  Thanks</p>