title: How to select nested property using Hibernate Criteria
body: <p>I have three entities such as Registration, User and Country. Basically a registration belongs to a user and a user belongs to a country. Now I am trying to select country name from registration with the following </p>
  
  <pre><code>        Criteria criteria = getSession().createCriteria(Registration.class);
          ProjectionList projectionList = Projections.projectionList();
          criteria.createAlias("user.country", "usercountry");
          projectionList.add(Projections.property("usercountry.name"),"usercountry.name");
          criteria.setProjection(projectionList);
          criteria.list();
  </code></pre>
  
  <p>This fails and give me :</p>
  
  <pre><code>ERROR: org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Unknown column 'usercountr1_.name' in 'field list'
  org.hibernate.exception.SQLGrammarException: Unknown column 'usercountr1_.name' in 'field list'
  </code></pre>
  
  <p>Generated Hibernate query :</p>
  
  <pre><code>Hibernate: select usercountr1_.name as y0_ from voucherList this_
  </code></pre>
  
  <p>I noticed there's no join in the sql. Is this why the query failed ? How can I fix this ?</p>