public int getStatus() {
        if (ptm == null) {
            return TransactionManager.STATUS_NO_TRANSACTION;
        }

        logger.debug("Current TX name (According to TransactionSynchronizationManager) : " + TransactionSynchronizationManager.getCurrentTransactionName());
        if (TransactionSynchronizationManager.isActualTransactionActive()) {
            TransactionStatus transaction = null;
            try {
                if (currentTransaction == null) {
                    transaction = ptm.getTransaction(td);
                    if (transaction.isNewTransaction()) {
                        return TransactionManager.STATUS_COMMITTED;
                    }
                } else {
                    transaction = currentTransaction;
                }
                logger.debug("Current TX: " + transaction);
                // If SynchronizationManager thinks it has an active transaction but
                // our transaction is a new one
                // then we must be in the middle of committing
                if (transaction.isCompleted()) {
                    if (transaction.isRollbackOnly()) {
                        return TransactionManager.STATUS_ROLLEDBACK;
                    }
                    return TransactionManager.STATUS_COMMITTED;
                } else {
                    // Using the commented-out code in means that if rollback with this manager,
                    //  I always have to catch and check the exception 
                    //  because ROLLEDBACK can mean both "rolled back" and "rollback only".
                    // if ( transaction.isRollbackOnly() ) {
                    //     return TransactionManager.STATUS_ROLLEDBACK;
                    // }

                    return TransactionManager.STATUS_ACTIVE;
                }
            } finally {
                if (currentTransaction == null) {
                    ptm.commit(transaction);
                }
            }
        }
        return TransactionManager.STATUS_NO_TRANSACTION;
    }
public int getStatus ( ) { if ( ptm == null ) { return TransactionManager . STATUS_NO_TRANSACTION ; } logger . debug ( "Current TX name (According to TransactionSynchronizationManager) : " + TransactionSynchronizationManager . getCurrentTransactionName ( ) ) ; if ( TransactionSynchronizationManager . isActualTransactionActive ( ) ) { TransactionStatus transaction = null ; try { if ( currentTransaction == null ) { transaction = ptm . getTransaction ( td ) ; if ( transaction . isNewTransaction ( ) ) { return TransactionManager . STATUS_COMMITTED ; } } else { transaction = currentTransaction ; } logger . debug ( "Current TX: " + transaction ) ; if ( transaction . isCompleted ( ) ) { if ( transaction . isRollbackOnly ( ) ) { return TransactionManager . STATUS_ROLLEDBACK ; } return TransactionManager . STATUS_COMMITTED ; } else { return TransactionManager . STATUS_ACTIVE ; } } finally { if ( currentTransaction == null ) { ptm . commit ( transaction ) ; } } } return TransactionManager . STATUS_NO_TRANSACTION ; }
Borrowed from Seam