今天在用动态sql做一个分类查询时,动态sql部分老是报异常,如下:
Caused by: 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 '' at line 16
经排查得知是动态sql部分的注释的原因:
日志打印的sql语句:
解决方案:将注释取消掉后程序正常运行