org.hibernate.hql.internal.ast.QuerySyntaxException: Path expected for join!

错误信息

org.hibernate.hql.internal.ast.QuerySyntaxException: Path expected for join! [select a,b.userlogo from cn.com.bean.AnswerPost  a  inner join User b where  a.answer_name=b.username and a.post_id=?]


错误背景

1、ssh框架的javaweb项目

2、对数据库两张表进行连接查询


错误原因

Hibernate不认识join,换成","就可以了

错误示例

String sql="select a,b.userlogo from AnswerPost  a left join User b where  a.answer_name=b.username and a.post_id=?";

正确示例

String sql="select a,b.userlogo from AnswerPost  a , User b where  a.answer_name=b.username and a.post_id=?";

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