此SQl如何转换成hql语句
select ce.lconsignId ,ce.szvesselName,ce.szvoyageCode,ce.sztakeBillNo ,cec.dtenter,ell.dtenter,cec.ustatus ,ell.bin
from ConsignExport ce ,
(select cec.lconsignid , cec.ustatus,min(cec.dtenter) dtenter from ConsignExportContainer cecwhere cec.dtenter is not null group by cec.lconsignid ,cec.ustatus) cec,
(select ell.lconsignId , ell.bin,min(ell.dtenter)dtenter from EnterLeaveLog ell
where ell.lconsignId is not null and ell.dtenter is not null
group by ell.lconsignId ,ell.bin) ell
where ce.lconsignId = cec.lconsignId and cec.lconsignid = ell.lconsignid and ell.dtenter is not null
and ce.uconsignStatus='1' order by ce.lconsignId
如果使用createSQLquery()函数,具体怎样写。
上述sql 在oralce 中测试可以通过,但直接使用 getHibernateTemplate().find(hql)会报错误。
大家看看怎么解决?
select ce.lconsignId ,ce.szvesselName,ce.szvoyageCode,ce.sztakeBillNo ,cec.dtenter,ell.dtenter,cec.ustatus ,ell.bin
from ConsignExport ce ,
(select cec.lconsignid , cec.ustatus,min(cec.dtenter) dtenter from ConsignExportContainer cecwhere cec.dtenter is not null group by cec.lconsignid ,cec.ustatus) cec,
(select ell.lconsignId , ell.bin,min(ell.dtenter)dtenter from EnterLeaveLog ell
where ell.lconsignId is not null and ell.dtenter is not null
group by ell.lconsignId ,ell.bin) ell
where ce.lconsignId = cec.lconsignId and cec.lconsignid = ell.lconsignid and ell.dtenter is not null
and ce.uconsignStatus='1' order by ce.lconsignId
如果使用createSQLquery()函数,具体怎样写。
上述sql 在oralce 中测试可以通过,但直接使用 getHibernateTemplate().find(hql)会报错误。
大家看看怎么解决?