问题描述
XML映射文件与前端界面相连时 idea报错sql语句有问题:
2023-09-02 19:13:50.016 ERROR 3452 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherS
ervlet]: Servlet.service() for servlet [dispatcherServlet] in context with path
[] threw exception [Request processing failed; nested exception is org.springframework
.jdbc.BadSqlGrammarException:
### Error querying database. Cause: java.sql.SQLSyntaxErro
rException: You have an error in your SQL syntax; check th
e manual that corresponds to your MySQL server version for
the right syntax to use near 'LIMIT 5' at line 5
原因分析:
检查了xml的sql语句发现结尾有一个分号导致idea把desc当作desc;
解决方案:
删掉之后前端界面就可以正常显示了