Does hibernate has support on select distinct on queries?
SELECT DISTINCT ON (location) location, time, report
FROM weather_reports
ORDER BY location, time DESC;
Is there a way to create hibernate criterias for that query?
Does hibernate has support on select distinct on queries?
SELECT DISTINCT ON (location) location, time, report
FROM weather_reports
ORDER BY location, time DESC;
Is there a way to create hibernate criterias for that query?
Since there was all "suspecting" and "guessing" here, when I stumbled across this question, I'll answer it definitely:
No, Hibernate does not support a DISTINCT ON query.
org.hibernate.hql.internal.ast.QuerySyntaxException:
unexpected token: ON near line 1, column 17
[SELECT DISTINCT ON (location) location, time, report FROM weather_reports ORDER BY location, time DESC]
Tested under Hibernate 4.3.9-final
Please note that this doesn't apply to normal DISTINCT queries. See https://stackoverflow.com/questions/263850...