hql是不存在on关键字的,如果直接使用改语句是会报left join异常
// full join 是left outer join和right outer join的并集
select consumer, order, product, comment
from ConsumerBean consumer
left join consumer.orderBeans order
left join order.productBeans product
left join product.commentBeans comment
where consumer.id = ?
order by order.id desc
HQL中的条件用with即:left join … with…?
SQL中的条件用on即:left join … on…?
语句inner join, left outer join 以及 right outer join
可以简写。
from Cat as cat
join cat.mate as mate
left join cat.kittens as kitten
with kitten.bodyWeight > 10.0
通过HQL的with关键字,你可以提供额外的join条件