版权声明:博客知识产权来源命运的信徒,切勿侵权 https://blog.csdn.net/qq_37591637/article/details/88909821
错误信息如下
<pre>org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: on near line 1, column 71 [select a,b.userlogo from cn.com.bean.AnswerPost a inner join User b on a.answer_name=b.username where a.post_id=?]
错误原因
在编写HQL时,可能会出现这种代码:
select a.name,b.age from TableA a left join TableB b on a.id=b.id ( 如是HQL,×)
因为HQL不支持ON这个字符,如果要做关联关系就必须将On改为where:
select a.name,b.age from TableA a left join TableB b where a.id=b.id (√)