sbl
sbl

Reputation: 11

Hibernate HQL double inner join

I try to launch this HQL query :

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

I catch this exception : ORA-01427: sous-interrogation ramenant un enregistrement de plus d'une ligne

What's wrong with my query ? Thanks

Upvotes: 1

Views: 924

Answers (1)

Joe Taras
Joe Taras

Reputation: 15379

Try this:

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

If programs is an entity, but if programs is a collection you can't do a JOIN between programs and elements

Please change question title, you use INNER JOIN in your query not LEFT JOIN

Upvotes: 1

Related Questions