我想将此SQL转换为HQL:
select t1.id , COUNT(*) as number
from Table1 t1
inner join Table2 t2 on t1.id = t2.id
WHERE t2.id = 2 OR t2.id = 3
GROUP BY t1.id
HAVING COUNT(*) = 2
有人可以帮我吗?
PS:我发现这个解决方案对我有用 SQL:select t1.id
from Table1 t1
inner join Table2 t2 on t1.id = t2.id
inner join Table2 t3 on t1.id = t3.id
WHERE t2.id = 2
and t3.id = 3
HQL:
select t1 from Table1 t1
inner join t1.fonctionalObject t2
inner join t1.fonctionalObject t3
where t2.id = 2
and t3.id = 3