dongoewang commented on issue #30242: URL: https://github.com/apache/shardingsphere/issues/30242#issuecomment-1960815974
> > Thanks a lot.I want to ask only question:after integrating shardingsphere-seata, in order to rollback,only method is 【Manually obtain the java.sql.Connection instance created from the ShardingSphere data source, and manually calling rollback() methods】? > > * In the context of web frameworks, you can set up rollback through JTA annotations, such as `javax.transaction.Transactional`, `jakarta.transaction.Transactional` and `org.springframework.transaction.annotation.Transactional`. Other JTA annotations for local transactions are also available, the only limitation is that you cannot use Seata Java APIs like `io.seata.spring.annotation.GlobalTransactional`. More elaboration in the context of [SpringCloud+Seata1.5.2+ShardingSphereJDBC5.2.1 SeataATShardingSphereTransactionManager.commit throw null exception #22356 (comment)](https://github.com/apache/shardingsphere/issues/22356#issuecomment-1948463141) . Please ignore the description of `@ShardingTransactionType`, which is a deleted class. > > > 但是这里要注意一个问题!!!!!! > > 虽然SeataATShardingTransactionManager和GlobalTransactionScanner做的事情一样,但是二者绝对不能混合使用!!!!!! > > 也就是说@ShardingTransactionType(TransactionType.BASE)和@GlobalTransactional绝对不能同时出现!!!!!! > > 看过上面SeataATShardingTransactionManager你就能明白,ShardingSphere把获取到的全局事务,放到了线程的局部变量里面了。而GlobalTransactionScanner则是采用动态代理的方式对方法进行增强。根本不能放在一起,杂交是要出问题的! > > ok!最终总结一句! > > 只要你的项目中用到sharding-jdbc,那么你全部微服务都需要导入seata整合sharding-jdbc的jar包 > > 而且,你的项目中千万不能再出现@GlobalTransactional注解了,用SeataATShardingTransactionManager就可以了。 > > * You cannot set the isolation level of a transaction because this is a limitation imposed by Seata-AT. > * The web frameworks I am talking about include but are not limited to Spring Boot OSS, Quarkus, Micronaut and Helidon. Using JTA annotations like `javax.transaction.Transactional` requires the existence of an IOC concept. I have two questions,after we integrated shardingsphere-seata (sorry,question become more.) question 1: for example,there are two micro service:project A ;project B project A @org.springframework.transaction.annotation.Transactiona public test2(){ updateTable1()table1 of db1 projectb.test3() } project b @org.springframework.transaction.annotation.Transactiona public test3(){ updateTable2()//table2 of db2 throw exception; } when running projectA.test2(),projectb.test3 throw exception.can SeataATShardingTransactionManager notify project A to rollback? question 2: [只要你的项目中用到sharding-jdbc,那么你全部微服务都需要导入seata整合sharding-jdbc的jar包]: project a use SeataATShardingTransactionManager,can other project use GlobalTransactionScanner? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
