java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: student is not mapped

Spring 5.0 +Jpa,使用@Query实现 自定义查询报错:

java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: student is not mapped [select id,name,createtime,sex,age from student s]

原因是查询语句中 from 后面写的是实体类名,而不是表名。

上一篇:继承映射中的java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: person is not mapped [FROM person]


下一篇:org.hibernate.hql.internal.ast.QuerySyntaxException: XXX is not mapped