You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "ulwx (via GitHub)" <gi...@apache.org> on 2023/03/24 03:44:51 UTC

[GitHub] [shardingsphere] ulwx commented on issue #24735: An null exception occurred when integrating seata

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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org