Thank you both for the replies. I've got some awkward results testing this: with H2 the test passes with this query:
select prod.cat_id, avg(prod.price), cat.id, cat.name from Product prod inner join Category cat on prod.cat_id = cat.id group by prod.cat_id
which someway doesn't fail, while with SQL Server the same query fails with:
Column 'Category.id' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Being the spec generic about this, I agree this is not a violation per se… but I really think Hibernate should handle this, as it is counter-intuitive.