title: Fluent NHibernate join for property value
body: <p>I'm trying to join a table to retreive and set a property on a POCO. Here's the scenario...</p>
  
  <p>*NOTE - An application can belong to many user sessions.</p>
  
  <p><img src="https://i.stack.imgur.com/oy8D9.png" alt="Model relationship"></p>
  
  <h2>UserSession (Table)</h2>
  
  <pre><code>UserSessionId PK
  ApplicationId FK
  UserName
  </code></pre>
  
  <h2>Application (Table)</h2>
  
  <pre><code>ApplicationId PK
  Name
  </code></pre>
  
  <h2>UserSession (Poco)</h2>
  
  <pre><code>string UserName get;
  string ApplicationName get;
  </code></pre>
  
  <p>I've tried a join like this: </p>
  
  <pre><code>Join("Application", j =&gt; j.Inverse().KeyColumn("ApplicationId").Map(x =&gt; x.ApplicationName));
  </code></pre>
  
  <p>However, this uses the primary column of the UserSessionTable for the join column. The part of the query looks like this: </p>
  
  <pre><code>/**SNIP**/
  inner join
   Auditing.UserSession US
       on this_.UserSessionId=US.UserSessionId
  left outer join
   Auditing.Application A
       on US.UserSessionId=A.ApplicationId
  /**SNIP**/
  </code></pre>
  
  <p>How can i configure nhibernate fluently to use the correct join column from the left table(UserSession)?</p>