死锁Deadlock
updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction
sql语句:
update table set money= money+? where id = ?
就这样一个语句,为什么出现死锁呢?整个表没有任何索引,id是主键。
我用的是spring+mybatis+mysql(InnoDB)
这个方法上有事务注解,应该是并发导致的死锁,我现在没想明白为什么会死锁呢?
有什么解决办法呢?