code: public static boolean isUncommitted(Transaction tx)
     {
        if (tx == null)
           return false;
        
        try
        {
           int status = tx.getStatus();
  
           return status == Status.STATUS_ACTIVE || status == Status.STATUS_MARKED_ROLLBACK;
        }
        catch (SystemException error)
        {
           throw new RuntimeException("Error during isUncommitted()", error);
        }
     }
docs: Is the transaction uncommitted
  @param tx The transaction
  @return True if uncommitted; otherwise false