错误:
org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [update t_account set money=money-?where username=?]; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'username='lucy'' at line 1
我仔细的在下面的错误中找到原因:
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'username='lucy'' at line 1
那么就尝试修改dao层的接口实现类里面的数据库语句
这是原先的代码:
出错的原因是?没有与where用空格隔开
好了,错误解决完成