hibernate join left join hql 用法及替代方案
1、hibernate 中?left join 在hql? 用之前,比如 A left join B必须关联为 a对象有b对象的应用,且在a.hbm,xml文件中有对b的配置.否则会报nullPointerException等错误
?
2、a left join b??? 没有on 关键字, sql 翻译自动为关联a.xxx left out join b.id
???? 想a left join b with a.xx?=b.xx? 是不支持的
?
3、如果a 左关联的不是b的id,不如关联b的bxx属性 则可如下变换
?
?? select? a from? A?a??,B b? where a.axx=b.bxx or a.axx is null
?
?
2 楼 zhouchaofei2010 2012-02-14 配置文件xml中a关联b中非主键字段。需加上属性pro-ref。也许能行