关于HQL的left join语法问题。

cklxh 2013-07-21 12:51:39

select b from
TableA a right join a.post b
with a.evaluationPlan.type = ?
where a.post.id is null and b.postGroup.id = ?

要报错,说with语法错误。

00:48:32,527 ERROR PARSER:35 - *** ERROR: line 1:91: unexpected token: with

如果我把with a.evaluationPlan.type = ?这句去掉,就没问题。
但是我就是想写类似sql中left join on的这种语法,查了百度,说hql中on为with,但是为何我这样写就要报错,无论我写on还是with。

而且这hql写左右连接,,实在太过烦人。万分感谢!!!
...全文
635 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
cklxh 2013-07-21
  • 打赏
  • 举报
回复

select c from
 TableA a
 inner join a.evaluationPlan b with b.type = ?
 right join a.post c where a.post.id is null and c.postGroup.id = ? 
加上3.1的hibernate,这样写就可以了。 来人接分涩。
cklxh 2013-07-21
  • 打赏
  • 举报
回复
太让人 蛋疼了,,3.1里面才有with,3.0里面没有。。。而且with后面还不准两个小数点,改成inner加with就好了。。
cklxh 2013-07-21
  • 打赏
  • 举报
回复
刚刚看了一下hibernate的源码,才发现with在我的版本中没有,在4.1中就有,,谁能告诉我第一个有with的版本吗?

24,923

社区成员

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

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