首页 > 解决方案 > 为什么本机查询有效而 hql 查询无效

问题描述

我遇到了这个 hql 查询的问题。它返回org.hibernate.hql.ast.QuerySyntaxException: unexpected end of subtree 是不是因为from核心选择中没有?我尝试使用本机查询,它工作正常。这个hql有什么解决方法吗?

select case when exists (
    select 1 from table1 t1
    left join table2 t2 on t1.id = t2.id
    left join table3 t3 on t3.other.id = t2.other.id
    where t1.id = :id
    group by t3.column
    Having count(distinct t3.value) >1)
then false
else true
end

标签: sqlhql

解决方案


推荐阅读