Hi all,
I'm having a problem with using an aggregation in the where clause for an HQL query. it's pretty simple, something like this:
Code:
from Job as job
group by job.type
having max(job.end_time)
Basically, I get the following error:
Code:
Exception in thread "main" org.hibernate.hql.ast.QuerySyntaxException: unexpected AST node: max near line 1, column 67 [ from com.hp.cast.hibernate.Job as job group by job.name having max(job.end_time) ]
Which is right at the "m" of "max"
I see the following documentation:
http://docs.jboss.org/hibernate/core/3. ... l-groupingActually mentions that MySQL is an example of a database that cannot use aggregates in the having clause, however, I can do that just fine on my database:
Code:
mysql> select name,end_time from job group by name having max(end_time);
...
367 rows in set (0.13 sec)
and, the mysql docs confirm that it
can do this on anything newer than 3.23:
http://dev.mysql.com/doc/refman/4.1/en/select.htmlIs there a reason this is restricted in hibernate when it works on current mysql versions?
Thanks!!