Hibernate HQL双内连接

时间:2013-09-03 13:07:32

标签: hibernate hql inner-join

我尝试启动此HQL查询:

select elt.id from Delivery as dly  
    inner join  dly.programs as pgm
    inner join pgm.elements as elt
where dly=:deliveryid

我抓住了这个例外: ORA-01427:sous-interrogation ramenant un enregistrement de plus d'une ligne

我的查询有什么问题?感谢

1 个答案:

答案 0 :(得分:1)

试试这个:

select elt.id from Delivery as dly  
inner join FETCH dly.programs as pgm
inner join FETCH pgm.elements as elt
where dly=:deliveryid

如果程序是一个实体,但如果程序是一个集合,则无法在程序和元素之间进行联接

请更改问题标题,在查询中使用INNER JOIN而不是LEFT JOIN