Springcloud distributed service dirty read deadlock solution

Solve exceptions such as dirty read deadlocks in springcloud distributed services

When querying and updating the same table, you need to use select...for update to perform row-level locks

//Set transaction propagation characteristics and isolation level
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, rollbackFor = {Throwable.class})
select
<include refid="Base_Column_List" />
from t_account_detail t
where t.user_id = #{userId}
for update;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326213786&siteId=291194637