异常:
org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute query; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query
sql原语句:
@Query(nativeQuery = true,value = "select sid,sname,gender from students where sname like concat('%',?1,'%')")
List<Students> findStudentsListVague(String sname);
原因:
hbm等和db映射不一致
解决方案:
修改查询的结果
@Query(nativeQuery = true,value = "select * from students where sname like concat('%',?1,'%')")
List<Students> findStudentsListVague(String sname);