空指针和SQL语法错误org.springframework.jdbc.BadSqlGrammarException: ### Error updating database. Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that

下单的时候报错,空指针和SQL语法错误等,后来发现SQL语句写错好几处,多了”  ,;  (  “      少了”  =  “  时有发生

 排查错误时发现不能把参数返回给rows

控制台报错SQL语法

org.springframework.jdbc.BadSqlGrammarException: 
### Error updating 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 ')' at line 5
### 

查看VideoOrderMapper.xml果然语法还有错误,去掉逗号和分号

更改SQL语句后rows已经有值了

下单成功

 

查看数据库,用户下单成功

 

原文地址:https://www.cnblogs.com/ooo888ooo/p/13214020.html