自学内容网 自学内容网

【异常处理】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 语句报错


原文地址:https://blog.csdn.net/Supreme7/article/details/136520894

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!