一、有主外键的表,主表锁库FOR UPDATE,子表也会被锁库。
二、项目A-ServiceA(有事务),锁库表A或更新表A,调项目B的接口,且接口中也锁表A或更新表A,此时会导致死锁。
三、ServiceA和ServiceB有相同事务,当ServiceA调ServiceB,并try ServiceB,ServiceB报错,会导致ServiceA在commit时报Transaction rolled back because it has been marked as rollback-only,以下几种场景不会报此异常:
- ServiceA方法中调ServiceA另外一个方法
- ServiceA方法中调DaoB的方法
- ServiceA方法中调ServiceB的方法,但是ServiceB的方法和ServiceA的事务不一致。
- ServiceA方法中调ServiceB的方法,不try catch。