title: Attaching a disconnected nHibernate entity to a session and reading from the database
body: <p>I am new to nHibernate. I have a method which receives a list of disconnected nHibernate entities. In each entity, I have got the primary key set (the primary key is always a field called Id, which is an int).</p>
  
  <p>What I am trying to achieve at this point is to connect to the database and fill each entity up with it's values for that primary key. I am using fluent mappings.</p>
  
  <p>I'm not sure, but is it possible to attach the entity to a session/connection, and some how get the data based on the id generically?</p>
  
  <p>Edit: More concrete info.</p>
  
  <p>I have several nhibernate entities (e.g. User, Account) that inherit from a base class (e.g. EntityBase). This base class contains a common primary key.</p>
  
  <p>I am passing a list of these entities, with the primary key populated.</p>
  
  <pre><code>public void RetrieveEntities(List&lt;EntityBase&gt; entities)
  </code></pre>
  
  <p>At this point, I would like cycle through these entities and get the full entity from the data source. Is it possible or am approaching this from the wrong way?</p>
  
  <p>If any clarification of the question is required, please leave a comment. Cheers. </p>