title: Hibernate Criteria order by count of child records
body: <p>I have two classes: News and Comments with one-to-many association between them.
  I am using Hibernate Criteria to fetch news from database. I would like my news to be ordered by the count of its comments.</p>
  
  <pre><code>session.createCriteria(News.class, "n");
  criteria.createAlias("n.comments", "comments");
  criteria.setProjection(Projections.projectionList()
      .add(Projections.groupProperty("comments.id"))
      .add(Projections.count("comments.id").as("numberOfComments")));
  criteria.addOrder(Order.desc("numberOfComments"));
  List&lt;News&gt; news = criteria.list();
  </code></pre>
  
  <p>With the following code I'm getting not the list of news but the list of objects with two Long's in each of them.
  What should I do to get the list of sorted news objects?</p>