public T run(boolean initTable) throws MetaException, NoSuchObjectException {
      try {
        start(initTable);
        String savePoint = isInTxn && allowJdo ? "rollback_" + System.nanoTime() : null;
        if (doUseDirectSql) {
          try {
            directSql.prepareTxn();
            setTransactionSavePoint(savePoint);
            this.results = getSqlResult(this);
            LOG.debug("Using direct SQL optimization.");
          } catch (Exception ex) {
            handleDirectSqlError(ex, savePoint);
          }
        }
        // Note that this will be invoked in 2 cases:
        //    1) DirectSQL was disabled to start with;
        //    2) DirectSQL threw and was disabled in handleDirectSqlError.
        if (!doUseDirectSql) {
          this.results = getJdoResult(this);
          LOG.debug("Not using direct SQL optimization.");
        }
        return commit();
      } catch (NoSuchObjectException | MetaException ex) {
        throw ex;
      } catch (Exception ex) {
        LOG.error("", ex);
        throw new MetaException(ex.getMessage());
      } finally {
        close();
      }
    }
Helper class for getting stuff w/transaction, direct SQL, perf logging, etc.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java