springboot_mybatis_pageHelper所遇到的問題點

Phoenix_99發表於2020-12-25

1,Result Maps用錯,應該用resultType

2020-12-25 11:32:12.796 ERROR 5576 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalArgumentException: Result Maps collection does not contain value for com.yjg.honest.mybatis.bean.Product] with root cause

java.lang.IllegalArgumentException: Result Maps collection does not contain value for com.yjg.honest.mybatis.bean.Product
    at org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:1031) ~[mybatis-3.5.6.jar:3.5.6]

 

2.mybatis對映檔案裡,SQL文加了分號,應去除分號。

### The error occurred while setting parameters
### SQL: select * from product; LIMIT ?
### Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 2' at line 1
; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 2' at line 1] with root cause

 

相關文章