title: How to partially project a child object with many fields in nHibernate
body: <p>I have the following nHibernate query that select a course based on its course id and then return <strong>selected fields</strong> for the course object on the initial fetch, and the query executes with no issues.</p>
  
  <pre><code>MatchMode option = ... 
  CourseItem courseAlias  = null;
  TeacherItem teacherAlias = null;
  
  var query = session.QueryOver&lt;CourseItem&gt;()
      .JoinAlias(c =&gt; c.Teacher, () =&gt; teacherAlias)
      .Where(c =&gt; c.CourseID.IsInsensitiveLike(strNumber, option))
      .SelectList(list =&gt; list
                 .Select(c =&gt; c.CourseID).WithAlias(() =&gt; courseAlias.CourseID)
                 .Select(c =&gt; c.IsActive).WithAlias(() =&gt; courseAlias.IsActive)
                 .Select(c =&gt; c.CourseDesc).WithAlias(() =&gt; courseAlias.CourseDesc)
                 .Select(c =&gt; c.Teacher).WithAlias(() =&gt; courseAlias.Teacher))
                 .TransformUsing(Transformers.AliasToBean&lt;CourseItem&gt;())
  .List&lt;CourseItem&gt;();
  </code></pre>
  
  <p>I wanted to go a step further with the query to only return a partial teacher object, let's say i just wanted to return the ID and Name. So, I updated the projected list to as follows:</p>
  
  <pre><code>var query = session.QueryOver&lt;CourseItem&gt;()
      .JoinAlias(c =&gt; c.Teacher, () =&gt; teacherAlias)
      .Where(c =&gt; c.CourseID.IsInsensitiveLike(strNumber, option))
      .SelectList(list =&gt; list
                 .Select(c =&gt; c.CourseID).WithAlias(() =&gt; courseAlias.CourseID)
                 .Select(c =&gt; c.IsActive).WithAlias(() =&gt; courseAlias.IsActive)
                 .Select(c =&gt; c.CourseDesc).WithAlias(() =&gt; courseAlias.CourseDesc)
                 .Select(c =&gt; c.Teacher.ID).WithAlias(() =&gt; courseAlias.Teacher.ID)
                 .Select(c =&gt; c.Teacher.Name).WithAlias(() =&gt; courseAlias.Teacher.Name))
                 .TransformUsing(Transformers.AliasToBean&lt;CourseItem&gt;())
  .List&lt;CourseItem&gt;();
  </code></pre>
  
  <p>The query doesn't work because nHibernate has no idea how to resovled based on Teacher.ID and Teacher.Name. Any thoughts on whether it's possible to NOT fetch the <strong>entire child object</strong> back to a parent object?</p>
  
  <p>I've tried the following query and it works this is not my fully desired outcome </p>
  
  <pre><code>var query = session.QueryOver&lt;CourseItem&gt;(() =&gt; courseAlias)
      .JoinAlias(() =&gt; courseAlias.Teacher, () =&gt; teacherAlias)
      .Where(() =&gt; courseAlias.CourseID.IsInsensitiveLike(strNumber, option))
      .SelectList(list =&gt; list
                 .Select(() =&gt; courseAlias.CourseID)
                 .Select(() =&gt; courseAlias.IsActive)
                 .Select(() =&gt; courseAlias.CourseDesc)
                 .Select(() =&gt; teacher.ID)
                 .Select(() =&gt; teacher.Name))
      .List&lt;object[]&gt;();
  </code></pre>
  
  <p>I can query the right values but unable to transform it back correctly to the Course / teacher data type.</p>
  
  <p>Any thoughts?</p>
  
  <p>thanks!</p>