Closed huang714669 closed 3 months ago
I tested that transaction exceptions in version 5.3.1 can be rolled back normally, please update the version.
@Transactional(rollbackFor = Exception.class)
public void saveFailed() throws Exception {
orderMapper.insert(createOrderEntity(1L, 1L));
orderMapper.insert(createOrderEntity(2L, 2L));
orderMapper.insert(createOrderEntity(3L, 3L));
orderMapper.insert(createOrderEntity(4L, 4L));
if (true) {
throw new Exception("mock exception");
}
}
how update to 5.3.1 from 5.1.2, since i use spring-boot-starter and the latest starter version is 5.2.1
how update to 5.3.1 from 5.1.2, since i use spring-boot-starter and the latest starter version is 5.2.1
@Pace2Car please have a look, thank you.
Hi @huang714669l, spring-boot-starter
has been removed since 5.3.0 Release, it is recommended to use ShardingSphereDriver combined with YAML configuration.You can find upgrade suggestions on the official account.
Please refer to: https://shardingsphere.apache.org/document/5.3.0/en/user-manual/shardingsphere-jdbc/yaml-config/jdbc-driver/ https://shardingsphere.apache.org/document/5.3.0/en/user-manual/shardingsphere-jdbc/yaml-config/
Thanks @Pace2Car for your reply, can you share more message about why starter mode are removed and not recommended and replaced with jdbc driver mode
Welcome to follow the official WeChat public account, you can find detailed information in the articles published in the past.
About why starter mode are removed
, please refer to #22469
I tested that transaction exceptions in version 5.3.1 can be rolled back normally, please update the version.
@Transactional(rollbackFor = Exception.class) public void saveFailed() throws Exception { orderMapper.insert(createOrderEntity(1L, 1L)); orderMapper.insert(createOrderEntity(2L, 2L)); orderMapper.insert(createOrderEntity(3L, 3L)); orderMapper.insert(createOrderEntity(4L, 4L)); if (true) { throw new Exception("mock exception"); } }
@FlyingZC
hello ! I seem to have encountered the same problem. i use version sharding-jdbc-5.3.2 ,Transaction not rolled back this is link #28401 Thank you for taking the time to resolve it
There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.
shardingsphere-jdbc-core-spring-boot-starter
is deprecated and removed in 5.3.0, please try new version and use ShardingSphere Driver.
Bug Report
@Transactional not work, each update or insert operation will execute the commit action Background:
springboot version: 2.6.6
orm: mybatis-plus 3.5.2
db: mysql 5.7
local transaction
sharding configurations:
business code
Before report a bug, make sure you have:
Searched open and closed GitHub issues.
Read documentation: ShardingSphere Doc.
Please pay attention on issues you submitted, because we maybe need more details. If no response anymore and we cannot reproduce it on current information, we will close it.
Please answer these questions before submitting your issue. Thanks!
Which version of ShardingSphere did you use?
5.1.2
Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-JDBC
Expected behavior
Sharding-jdbc should work well with springboot @Transactional annatation
Actual behavior
After enable sharding-jdbca, @Transactional will not work
Reason analyze (If you can)
When not use sharding jdbc, the @Transaction can work as expected, so is sharding-jdbc caused this problem, it may change the transaction work-flow internally?