title: NHibernate CreateSQLQuery return list of objects with populated properties (i.e. eager loading)
body: <p>I am using Nhibernate in a c# application.</p>
  
  <p>I am loading a list of objects from the database using 'CreateSQLQuery'.
  The problem is that I also want one of the properties of that object to be populated at the same time. </p>
  
  <p>e.g.
  Given objects:
  Company
  Employee</p>
  
  <p>I have an SQL query looking something like this:</p>
  
  <pre><code>SELECT DISTINCT {e.*}, {c.*}
  FROM Employee e
  INNER JOIN Company c on e.company = c.id
  </code></pre>
  
  <p>(The actual query has a lot more complexity which is why I can't just use the criteria API or linq.)</p>
  
  <p>My code is then something like this:</p>
  
  <pre><code>ISQLQuery sql = session.CreateSQLQuery(sqlText);
  sql.AddEntity(e", typeof(Employee));
  sql.AddJoin("c",  "e.Company");
  sql.SetResultTransformer(new DistinctRootEntityResultTransformer());
  dbEmlpoyees = sql.List&lt;Employee&gt;().ToList();
  </code></pre>
  
  <p>However, this appears to return a flattened list (i.e. both Employee and Company objects are returned).
  I only want the Exployee objects returned but I want the Company property of Employee to be populated. Is this possible in one db call?</p>
  
  <p>(I could just get the list of employees and then populate the Company property for each record while the session is still open but this seems very inefficient)</p>