ulwx commented on issue #24735:
URL: 
https://github.com/apache/shardingsphere/issues/24735#issuecomment-1482207313

   @Transactional(propagation = Propagation.REQUIRED)
    @GlobalTransactional
    public void updateUseAkDs() {
        TransactionTypeHolder.set(TransactionType.BASE);
        addressDao.updateMdForMaster2(1, "123");
        try {
            addressDao.updateMdForMaster1(2, "abc");
        } catch (Exception ex) {
            LOGGER.debug(ex + "");
        }
   
    }
   
   @GlobalTransactional is an annotation from seata, indicating that this is a 
global transaction. When TransactionTypeHolder. set (TransactionType. BASE) is 
used in a method(using the @ GlobalTransactional annotation), an error will be 
reported. The reason is that sharding-jdbc determines in the code that if it is 
in a global transaction, SeataATShardingSphereTransactionManager#begin() is not 
executed, finally,  in the code ”SeataTransactionHolder. get(). commit()” in 
the SeataATShardingSphereTransactionManager#commit() method, 
SeataTransactionHolder. get()=null, resulting in a null exception!
   


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