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.
select p.*, (select count(*) from child where child.parentid = p.id) as LEVELS
from parent p