Closed Alice52 closed 1 year ago
@Transactional
Transaction rolled back because it has been marked as rollback-only
@Transactional(rollbackFor = Exception.class) public Boolean xxx(xxx dto) { list1 = .....; try { saveBatch(list1); // 报错会 marked as rollback-only } catch (Exception e) { if (e instanceof DuplicateKeyException) { // 此时这个事务是不能提交的 The database saves the filtered list1 in batches; } } }
@Transactional
注解@Transactional
+ try..catch 就可能引起嵌套事务报错@Transactional
注解删