[英]Postgresql 'select distinct on' in hibernate
hibernate是否支持select distinct on query?
SELECT DISTINCT ON (location) location, time, report
FROM weather_reports
ORDER BY location, time DESC;
有没有办法为该查询创建hibernate标准?
既然这里有“怀疑”和“猜测”,当我偶然发现这个问题时,我肯定会回答:
不,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下测试
请注意,这不适用于普通的DISTINCT查询。 请参阅https://stackoverflow.com/questions/263850 ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.