Postgresql在休眠中``选择不同的开启''

编程入门 行业动态 更新时间:2024-10-27 14:28:52
本文介绍了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在休眠中``选择不同的开启''

本文发布于:2023-10-24 09:20:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1523559.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Postgresql

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!