code: public String currentTransactionId() {
          try {
              javax.transaction.Transaction txn = txnMgr.getTransaction();
              return txn != null ? txn.toString() : null;
          } catch (SystemException e) {
              return null;
          }
      }
docs: Get a string representation of the current transaction if there already is an existing transaction.
  
  @return a string representation of the transaction if there is an existing transaction, or null if there is none