我有以下HQL
SELECT distinct demand FROM MyDemand demand
where demand in ( SELECT invd FROM MyDemand invd
JOIN invd.MyDemandLine line
JOIN line.Restr restr
where restr.Order=:order)
问题是生成的SQL是:
...........
where
(
inventoryd0_.id, inventoryd0_.invNo
) in (
select
(inventoryd6_.id,
inventoryd6_.invNo)
from
MyDemand inventoryd6_
................
问题是sql在","失败了。来自" inventoryd6_.id,inventoryd6_.invNo"。如果我从SQL中删除环境括号,一切正常。 我使用Hibernate 3。?.这是休眠中的错误还是我做错了什么?
答案 0 :(得分:0)
我将查询更改为:
SELECT distinct demand FROM MyDemand demand
where exists ( SELECT 'x' FROM MyDemand invd
JOIN invd.MyDemandLine line
JOIN line.Restr restr
where restr.Order=:order
and invd=demand)