5.0.2下,手动回滚事务失效
- Dominant language
- Java
- Stars
- 4.2k
- Forks
- 1.4k
- PR merge metrics
- No merged PRs in 30d
Description
- [ ] I have searched the [issues](https://github.com/codingapi/tx-lcn/issues) of this repository and believe that this is not a duplicate.
### 1. Bug Description
5.0.2下,手动回滚事务失效
### 2. Environment:
- JDK version:1.8
- OS:
- TX-LCN version:5.0.2
- Others:
```
@Override
@LcnTransaction
@Transactional(rollbackFor = {Exception.class})
public boolean test() {
B_file b = new B_file();
b.setUrl("515645646");
b.setCategory("0");
save(b);
try {
int i = 1 / 0;// 异常
return true;
} catch (Exception e) {
// 事务回滚
System.out.println("事务回滚");
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();// 关键
return false;
}
}
```
以上是demo代码,下面的手动回滚事务会失效,如果这时候把下面的手动回滚事务改成 throw new RuntimeException();就可以成功回滚,但是这样对业务来是不友善,求解决
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.