HQL有多个join怎么办呢??(多次关联)

来源:百度知道 编辑:UC知道 时间:2024/05/27 06:32:46
有多个3个 用HQL查询的话 好像要用多个join 请问大家该怎么写呢??
我查父订单 o,
c是他的子单 c.product是子单中的产品外键 我要用p.名字作为查询条件 又要用一次join。。好像不对。。。
from parentorder o inner join o.childorder c inner join c.product p
where p.name='IBMX60' and c.quantity=6
如果像2楼说的那样 那么 HQL要Join有什么用???

childorder已经是parentorder的一个属性了,所以不用join
from Order o where o.childorder.quantity=6 and o.childorder.product.name='IBMX60'

hibernate支持属性的多层次检索

期待中……

用本地sql好了,hql烦人