wangjiandahai opened a new issue, #24694:
URL: https://github.com/apache/shardingsphere/issues/24694

   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub 
issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere 
Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   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?
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ### Expected behavior
   
   ### Actual behavior
   When use  seata-at as base tansaction type .
   transaction config:
   ```
     - !TRANSACTION
       defaultType: LOCAL
   ```
   
   spring boot datasource config:
   ```
   spring:
     datasource:
       driver-class-name: org.apache.shardingsphere.driver.ShardingSphereDriver
       url: jdbc:shardingsphere:classpath:sharding.yaml
   ```
   use HikariDataSource。
   
   one businesss code  use LOCAL, another businesss code use BASE like:
   ```
       @PostMapping(value = "addLocal")
       public Result add(@RequestBody OrderAddReq req) {
           return ResultTools.ofSuccess(orderService.add(req));
       }
   ```
   ```
       @PostMapping(value = "addBase")
       public Result add(@RequestBody OrderAddReq req) {
           TransactionTypeHolder.set(TransactionType.BASE);
           return ResultTools.ofSuccess(orderService.add(req));
       }
   ```
   ```
      @Transactional(rollbackFor = Exception.class)
       public boolean add(OrderAddReq req) {
           log.info("Seata全局事务id=================>{}", RootContext.getXID());
           OrderEntity order = new OrderEntity();
           order.setProductId(req.getProductId());
           order.setMoney(req.getMoney());
           order.setUserId(req.getUserId());
           order.setCount(req.getCount());
           order.setStatus(0);
           this.baseOrderService.save(order);
   
           AccountOpReq accountOpReq = new AccountOpReq();
           accountOpReq.setUserId(req.getUserId());
           accountOpReq.setMoney(req.getMoney());
           Result<?> result = accountApi.accountOp(accountOpReq);
           if(!result.success()){
               throw new BaseFlowException(result.getMsg());
           }
   
           if(req.getCount() == 10000){
               int i = 1/0;
           }
           return true;
       }
   ```
   When call local mode api first,use  Local mode ,then call base mode api,it 
will use Local mode。
   
   ### Reason analyze (If you can)
   5.3 use jdbc driver mode,HikariDataSource will pool 
ShardingSphereConnections.  but Connection's Transaction manager is setted when 
Connection create,will not change。
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   
   ### Example codes for reproduce this issue (such as a github link).
   


-- 
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]

Reply via email to