Hql查询问题

时间:2010-05-20 16:01:57

标签: sql hibernate hql

我有以下hql查询:

from Admin a where a.genericTable is null or (a.genericTable.allowInsertion = true or a.genericTable.allowInsertion is null)

问题是结果集排除了过滤器中包含的所有条目:a.genericTable is null

有谁知道为什么?

谢谢!

1 个答案:

答案 0 :(得分:1)

尝试左连接:

from Admin as a left join a.genericTable as g
where (g is null or (g.allowInsertion = true or g.allowInsertion is null))