title: Trouble using nHibernate 2.0's Session.Get<T> on a class with a composite-id
body: <p>I'm having trouble with something that (I think) should be simple, but can't find any clear info.</p>
  
  <p>In the scenario where I have three tables, describing a domain where a person can have more than one job:    </p>
  
  <p>Person - has PersonId, Name<br>
  Job - has JobId, JobName<br>
  PersonJob - has PersonId, JobId, YearsOfEmployment</p>
  
  <p>Note:  In my object model, I have entities representing each table.  I have that third entity to represent the Person/Job relationship since there is useful metadata there (YearsOfEmployment) and is not just a simple join table.</p>
  
  <p>So, if I knew the PersonId and the JobId, is there a simple way for me to use the session and return an object matching those Ids?</p>
  
  <p>Or, put a different way, since I already know the primary keys is there a brain-dead, simple way I can turn the SQL "SELECT YearsOfEmployment FROM PersonJob WHERE PersonId=1 AND JobId=1" into something like:  </p>
  
  <p><code>var keys = new {PersonId=1, JobId=2};<br>
  PersonJob obj = Session.Get&lt;PersonJob&gt;(keys);
  </code></p>
  
  <p>BTW:  maps would look something like this:</p>
  
  <pre><code>&lt;class name="Person" table="dbo.Person" lazy="true"&gt;
    &lt;id name="PersonId"&gt;
      &lt;generator class="native"/&gt;
    &lt;/id&gt;
    &lt;property name="Name"/&gt;
  &lt;/class&gt;
  &lt;class name="Job" table="dbo.Job" lazy="true"&gt;
    &lt;id name="JobId"&gt;
      &lt;generator class="native"/&gt;
    &lt;/id&gt;
    &lt;property name="JobName"/&gt;
  &lt;/class&gt;
  &lt;class name="PersonJob" table="dbo.PersonJob" lazy="true"&gt;
    &lt;composite-id&gt;
      &lt;key-property name="PersonId"&gt;&lt;/key-property&gt;
      &lt;key-property name="JobId"&gt;&lt;/key-property&gt;
    &lt;/composite-id&gt;
    &lt;property name="YearsOfEmployment"/&gt;
  &lt;/class&gt;
  </code></pre>