hql左连接查询

select new cn.manstro.sanyu.basedata.model.PersonFund(emp.id,ed.deptName,emp.empName,emp.bankAccount,emp.pinCode,f.basePay,f.behovePay,f.factPay,f.id) from Employee as emp left join emp.fundList as f with f.monthdate=:monthdate and f.yeardate=:yeardate left join emp.deptList as ed where ed.id=:deptId and emp.isDel=0

1.用hql进行对象查询时,需要写全对象的全路径
2.人员对fund是一对多,在人员表里定义 List<Fund> fundList,查询时 用emp.fundList即可关联。
3.left join ... with ...hibernate是用with作为条件

你可能感兴趣的:(Hibernate,F#)