title: NHibernate Criteria
body: <pre><code>public class A
  {    
  public string aname {get; set;}
  public string aId {get; set;}                                                
  public string bId {get; set;}
  }
  
  public class B 
  {    
  public string bId {get; set;}                                                
  public string bname {get; set;}                                                  
  public string cId {get; set;}
  }
  
  public class C 
  {                                                                                
  public string cId {get; set;}
  public string cfirstname {get; set;}    
  public string clastname {get; set;}
  }
  
  public class abcDTO
  {
  public string aname {get; set;}
  public string bname {get; set;} 
  public string clastname {get; set;}
  }
  </code></pre>
  
  <p>Evetually the query which I am looking is </p>
  
  <pre><code>SELECT a.aid, b.bname, c.clastname FROM A thisa 
  inner join B thisb on thisa.bid=thisb.bid
  inner join C thisc  on thisb.cid=thisc.cid and this_.POLICY_SEARCH_NBR like '%-996654%'
  </code></pre>
  
  <p>The criteria which I am trying is,  Please let me know the best possible way to write a criteria so that I can get the abcdto object as result</p>
  
  <pre><code>var policyInsuranceBusiness = DetachedCriteria.For&lt;A&gt;()
                  .SetProjection(Projections.Property("a.aid"))
                  .Add(Restrictions.Like("a.aid", "1-SAP-3-996654", MatchMode.Anywhere))
                  .CreateCriteria("b.bid", "b", JoinType.InnerJoin) 
                  .SetProjection(Projections.Property("b.bname")) // ERROR OUT - COULD NOT RESOLVE PROPERTY
                  .CreateCriteria("c.cid", "c", JoinType.InnerJoin)
                  .SetProjection(Projections.Property("c.clastname")); // ERROR - COULD NOT RESOLVE PROPERTY
  
  IList&lt;abcDTO&gt; plo = policyInsuranceBusiness.GetExecutableCriteria(_session).SetResultTransformer(NHibernate.Transform.Transformers
                  .AliasToBean&lt;abcDTO).List&lt;abcDTO&gt;();
  </code></pre>