I would like to perform the following query in HQL:
select count(distinct year(foo.date)) from Foo foo
However, this results in the following exception:
org.hibernate.hql.ast.QuerySyntaxException: expecting CLOSE, found '(' near line 1, column 27
It seems that hibernate does not allow using functions as arguments to its aggregation functions. Is there any way to get the required result?