I got such SQL query:
SELECT COUNT(count) as ovcount from (SELECT COUNT(id) AS count FROM table WHERE
field1=value1 and field2=value2 GROUP BY something1, something2, something3)
as T WHERE count > 1
How would that statement look in HQL? Hibernate doesn't support "the easy way" if a query contains subquery after FROM.