title: How do i transform a HQL result to List<T> where T is a mapped class
body: <p>I have this nhibernate query:</p>
  
  <pre><code>var q =
                 NHibernateSession.Current.CreateSQLQuery
                 (
                      @"SELECT  LastestEvents.*
                      FROM    (
                              SELECT  DISTINCT SbQcontainer.Container
                              FROM    HistoricEvents
                              SbQcontainer WHERE SbQcontainer.LineCompany_Id = :lineCompany) as Sbq
                               JOIN HistoricEvents as  LastestEvents
                      ON      LastestEvents.id = (
                              SELECT TOP(1) id
                              FROM    HistoricEvents mi
                              WHERE   mi.Container = Sbq.Container and mi.LineCompany_Id = :lineCompany
                              ORDER BY mi.Date DESC
                              )"
                 ).SetResultTransformer(Transformers.AliasToBean(typeof(HistoricEvent)));
  
              q.SetParameter("lineCompany",lineCompany.Id);
              q.SetCacheable(false);
  
              var results = q.List&lt;HistoricEvent&gt;().ToList();
  </code></pre>
  
  <p>It looks for the lastest events on each container for the given lineCompany, it works, but i dont know how to set this resultset to a list of  T HistoricEvent, i try this line:</p>
  
  <pre><code>.SetResultTransformer(Transformers.AliasToBean(typeof(HistoricEvent)));
  </code></pre>
  
  <p>But throws  NHibernate.PropertyNotFoundException:Could not find a setter for property 'Event_Id' in class 'HistoricEvent'.</p>
  
  <p>Is there any way to do this?, or maybe doing this same query using the ICriteria API?</p>
  
  <p>Thx in advance.</p>