Hibernate new 关键字具有不同的
我需要获取当前的 hql :
select distinct a from Asset as a where ...
并将其更改为
select new com.org.AssetDTO(a.id, a.address, a.status) from Asset as a where ...
My Problem is with the unique 关键字。它属于使用新对象查询类型的 hql 查询中的哪个位置。一种想法是使用子选择并在那里有我的独特之处。我尝试添加 distinct a.id
但这不起作用。
I need to take hql that is currently :
select distinct a from Asset as a where ...
and change it to
select new com.org.AssetDTO(a.id, a.address, a.status) from Asset as a where ...
My problem is with the distinct keyword. Where does it belong in an hql query where you're using the new Object query type. One thought was to use a sub-select and have my distinct there. I've tried adding distinct a.id
but that doesn't work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,对于任何感兴趣的人来说,正确的语法是
Ok for anyone interested the proper syntax is