一尘不染

PostgreSQL在冬眠中``选择不同的开启''

sql

休眠是否对选择查询有支持?

SELECT DISTINCT ON (location) location, time, report
FROM weather_reports
ORDER BY location, time DESC;

有没有一种方法可以为该查询创建休眠条件?


阅读 123

收藏
2021-05-23

共1个答案

一尘不染

由于这里存在所有“怀疑”和“猜测”,因此当我偶然发现此问题时,我肯定会回答:

否,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下测试

2021-05-23