Don't use aliases on columns. Refer to them by their name. Like on this example from http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/queryhql.html#queryhql-grouping
select cat
from Cat cat
join cat.kittens kitten
group by cat.id, cat.name, cat.other, cat.properties
having avg(kitten.weight) > 100
order by count(kitten) asc, sum(kitten.weight) desc