hibernate - Rewriting HQL to convert right join to left join -
i have following object model:
account accounttransaction has many-to-one account paymentschedulepayment has many-to-one accounttransaction paymentscheduleperiod has many-to-one account
and want hql
find me paymentscheduleperiod
active on given date , each 1 find latest paymentschedulepayment
linked same account. there may no payments hence outer join.
i have query works fine:
select p.id, a.id, max( pay.accounttransaction.dttm ) paymentschedulepayment pay right join pay.accounttransaction.account a, paymentscheduleperiod p p.account = , p.fromdttm <= :date , p.todttm > :date group p.id, a.id
however this question having trouble because of ordering precedence of joins explained in accepted answer. 1 of comments avoid issues should use left outer join instead of right i'm not sure how rewrite hql
of form
from account left join ... paymentschedulepayment
my, possibly incomplete, understanding in hql can outer joins via object model.
can suggest how can rewrite above suggested using left rather right joins?
Comments
Post a Comment