hql 左连接?

zifeng858 2009-09-24 02:09:47
hql:语句

select new map(a.regino as regino,f.yhmc as yhmc,a.regtime as regtime ,b.brist as brist,d.invpt as invpt ,d.pttype as pttype,d.regno as regno,d.tel as tel,d.marname as marname,d.addr as addr,d.ubindtype as ubindtype,d.enttype as enttype,
g.invobtype as invobtype,g.yiedistrict as yiedistrict,g.merimpsign as merimpsign,g.yieldly as yieldly,g.venspdistrict as venspdistrict,g.vensp as vensp,g.tmname as tmname,g.brandname as brandname,g.typespf as typespf,g.quan as quan,g.meaunit as meaunit)
from TsclDjxx a, TsclNrxx b ,FkSazt d,TsclTgfxx e, Dwgl c ,Yhgl f,FkSakt g where c.dwbm =a.regdep and f.yhbh=a.accregper and
a.regino=b.regino and b.regino=d.regino and d.regino=e.regino and b.infotype=1 and a.dealno=g.dealno(+)


表FkSakt要和他左外连接,因为这个表可能没有数据,执行这条语句报错,主要是 g.dealno(+),但是hibernate 又不支持左外连接,谁知道应该怎么改这条语句???

...全文
226 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
connor_zheng 2009-09-24
  • 打赏
  • 举报
回复
hql语句只查对像吧,外连接在hibernate配置文件中配置
sunnyfun888 2009-09-24
  • 打赏
  • 举报
回复
left out join ...
zifeng858 2009-09-24
  • 打赏
  • 举报
回复
左连接怎么改?
zifeng858 2009-09-24
  • 打赏
  • 举报
回复
更改成如下:hql


select new map(a.regino as regino)
from
TsclDjxx a left outer join FkSakt g on a.dealno=g.dealno,
TsclNrxx b ,FkSazt d,TsclTgfxx e, Dwgl c ,Yhgl f,FkSakt g
where c.dwbm =a.regdep and f.yhbh=a.accregper and
a.regino=b.regino and b.regino=d.regino and d.regino=e.regino and b.infotype=1
浴火涅磐 2009-09-24
  • 打赏
  • 举报
回复
楼主你写的简化些啊,表面看上去没有错误了,hibernate可以用子句来写
测试逍遥子 2009-09-24
  • 打赏
  • 举报
回复
HQL不适合做复杂的查询,建议用原生SQL

81,095

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧