休眠是否对选择查询有支持?
SELECT DISTINCT ON (location) location, time, report FROM weather_reports ORDER BY location, time DESC;
有没有一种方法可以为该查询创建休眠条件?
由于这里存在所有“怀疑”和“猜测”,因此当我偶然发现此问题时,我肯定会回答:
否,Hibernate不支持DISTINCT ON查询。
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]
在Hibernate 4.3.9-final下测试