spring事务管理测试调试

在这里插入图片描述
错误提示
信息: SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase, Hana]

sql语句错误,修改sql语句即可,在语句?后面添加一个空格
//收款时,收款用户的余额=现有金额+所汇金额
this.jdbcTemplate.update("update acount set balance = balance+? "
+“where username = ?”,money,inUser);
//模拟系统运行时突发性问题
int i = 1/0;
this.jdbcTemplate.update("update acount set balance = balance-? "
+“where username = ?”,money,outUser);
总结:在碰到需要有sql语句编写的情况下可以尝试将sql语句打印出来可以很明显的看出错误。

猜你喜欢

转载自blog.csdn.net/qq_40896997/article/details/89083678