【异常处理】BadSqlGrammarException低级SQL语法异常


报错

org.springframework.jdbc.BadSqlGrammarException: 
### Error querying database.  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 5' at line 3
### The error may exist in top/ambtwill/blog/dao/mapper/ArticleMapper.xml
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: select * from ms_article          WHERE 1=1          order by weight,create_date desc; 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 5' at line 3

发现原因

原因就是在Sql语句末尾加上了分号,导致在使用Mybatis-plus时拼接了limit 语句报错


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM