unexpected token: on near line 1, column 71 [select a,b.userlogo from cn.com.bean.AnswerPost a inn

错误信息如下

 

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=?]

unexpected token: on near line 1, column 71 [select a,b.userlogo from cn.com.bean.AnswerPost a inn_第1张图片


错误原因

在编写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 (

你可能感兴趣的:(sql,三大框架整合)