title: Hibernate criterion Projection alias not being used
body: <p>Do Hibernate Projection aliases even work?  I could swear it just doesn't.  At least, it doesn't do what I would expect it to do.</p>
  
  <p>Here is the java:</p>
  
  <pre><code>return sessionFactory.getCurrentSession()
      .createCriteria(PersonProgramActivity.class)
      .setProjection(Projections.projectionList()
          .add(Projections.alias(Projections.sum("numberOfPoints"), "number_of_points"))
          .add(Projections.groupProperty("person.id")))
      .setFirstResult(start)
      .setFetchSize(size)
      .addOrder(Order.desc("numberOfPoints"))
      .list();
  </code></pre>
  
  <p>Here is the SQL that it generates:</p>
  
  <pre><code>select
      sum(this_.number_of_points) as y0_,
      this_.person_id as y1_
  from
      PERSON_PROGRAM_ACTIVITY this_
  group by
      this_.person_id
  order by
      this_.number_of_points desc
  </code></pre>
  
  <p>It doesn't seem to use the alias at all.  I would think setting the alias would mean that <code>sum(this_.number_of_points)</code> would be aliased as <code>number_of_points</code> and not <code>y0_</code>.  Is there some trick I am missing?</p>
  
  <p>Thanks.</p>