不在 Hibernate 的子句中
我如何实现类似 --> 的目标?
Select sm.memCd, sm.entityName from MemberSBandAP sm
where sm.memStatus='Active' and sm.entityType='M'
and sm.memCd not in (select l.userName from Login l)
order by sm.entityName DESC, sm.memCd"
基本上我如何在休眠中编写 not in 子句?
我指的是 本教程第 14.10 节表达式
在那里他们说 not in 可以直接在查询字符串中使用,但查询不返回任何记录。浏览了其他示例,但大多数地方都说我们需要标准类别。真的需要吗?难道我们不能直接写子查询并使用not in吗?任何帮助将不胜感激。
预先感
谢斯维塔
How do I achieve something like -->
Select sm.memCd, sm.entityName from MemberSBandAP sm
where sm.memStatus='Active' and sm.entityType='M'
and sm.memCd not in (select l.userName from Login l)
order by sm.entityName DESC, sm.memCd"
basically how do I write a not in clause in hibernate?
I was referring to this tutorial section 14.10 Expressions
in there they say that a not in can be directly used in the query string, but the query is not returning any records. Goggled for other examples but most of the places it says that we need to criteria class. Is it really required? Can't we directly write a sub query and use not in? Any help will be greatly appreciated.
Thanks in advance
Sweta
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
not in
是有效的 HQL 表达式。确保子查询返回的值与过滤字段的值匹配。
not in
is a valid HQL expression.Make sure that the values returned by the subquery match to the values of the filtered field.
像这样使用=> sm.memCd 不在 elements 中(从登录 l 中选择 l.userName)
use like this => sm.memCd not in elements (select l.userName from Login l)