SpringJPA自定义查询时报错:
org.hibernate.hql.internal.ast.QuerySyntaxException
这是代码中发生了一些不匹配的情况,请对比一下写法,检查自己的代码:
@Query(value="select a.id as id,a.game_Name as gameName from co_smsfee_Temp a",nativeQuery = true)
public List<Map<String,Object>> findAllGetName();
注意的是:
1:字段名和表名都是按照数据库实际情况来写,而不是实体的字段。
2:要标注nativeQuery属性,告诉SpringJPA执行SQL查询。