本文介绍了Postgresql在休眠中``选择不同的开启''的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
休眠状态是否支持在查询中选择不同的内容?
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:
不,Hibernate不支持DISTINCT ON查询。
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]经过Hibernate 4.3.9-final测试
Tested under Hibernate 4.3.9-final
请注意不适用于普通的DISTINCT查询。 请参见 stackoverflow/questions / 263850 ...
Please note that this doesn't apply to normal DISTINCT queries. See stackoverflow/questions/263850...
更多推荐
Postgresql在休眠中``选择不同的开启''
发布评论