title: Hibernate Criteria and Count Column
body: <p>I am trying to return an entity with a column that has the count of another table that is a one to many relation. I want to do this using hibernate criteria, not HQL.</p>
  
  <pre><code>select p.*, (select count(*) from child where child.parentid = p.id) as LEVELS
  from parent p
  </code></pre>