【发布时间】:2010-01-19 20:50:30
【问题描述】:
HQL 菜鸟在这里。如何在不使用存在子句的情况下重写此 HQL 查询。在 SQL 中,我可以只加入 VisitorProfileField 表和 Visitor 表,并使用 AND 添加存在的条件。
但在普通的 HQL 中,我猜我无法克服一些语法违规。非常感谢您的帮助。
"select distinct v from Visitor v where v.id not in (select o.id from Operator o) " +
" and exists (select vpf from VisitorProfileField vpf " +
" where vpf.visitor = v and vpf.profileField.name = :subscription_field " +
" and vpf.numberVal = :type and vpf.stringVal = :manual) "
【问题讨论】: