我的存储库中有nativequery查询。
@Query(value = Constant.QUERY_FIND_GUIDE, nativeQuery=true)
List<Guide> findGuide(String locationName, String gender, String type, String language);
和constant.query\u find\u guide是
public static final String QUERY_FIND_GUIDE = "SELECT g.id FROM Guide g " +
" LEFT JOIN g.user u " +
" LEFT JOIN g.locations l " +
" LEFT JOIN g.languages lang "+
"WHERE (UPPER(?1)=UPPER('NULL') OR ?1 IS NULL OR ?1 ='' OR l.locationName = ?1) "
+ " AND (UPPER(?2)=UPPER('NULL') OR ?2 IS NULL OR ?2 ='' OR g.gender =?2) "
+ " AND (?3 IS NULL OR ?3 ='' OR "
+ " (CASE WHEN UPPER(?3)=UPPER('NULL') THEN g.cardnumber IS NULL ELSE g.cardnumber IS NOT NULL END) )"
+ " AND (UPPER(?4)=UPPER('NULL') OR ?4 IS NULL OR ?4='' OR lang.language = ?4)";
当我运行该页时,出现以下错误:
2018-04-24 03:05:32.198 warn 1340---[nio-8080-exec-4]o.h.engine.jdbc.spi.sqlexceptionhelper:sql错误:1064,sqlstate:42000 2018-04-24 03:05:32.198 error 1340---[nio-8080-exec-4]o.h.engine.jdbc.spi.sqlexceptionhelper:sql语法错误;查看与您的mysql服务器版本对应的手册,以获取正确的语法,以便在第1行2018-04-24 03:05:32.208 error 1340---[nio-8080-exec-4]c.w.tgo.controller.operatorcontroller:error search:org.springframework.dao.invaliddataaccessresourceusageexception:无法提取结果集;sql[不适用];嵌套异常为org.hibernate.exception.sqlgrammareexception:无法提取结果集
我在google上尝试了所有的解决方案,但都解决不了。有人能帮我吗?
暂无答案!
目前还没有任何答案,快来回答吧!