public int execute(String query, SqlParameterSource params,
                         Function<Integer, Boolean> resultPolicy) throws MetaException {
    LOG.debug("Going to execute command <{}>", query);
    int count = getJdbcTemplate().update(query, params);
    if (resultPolicy != null && !resultPolicy.apply(count)) {
      LOG.error("The update count was " + count + " which is not the expected. Rolling back.");
      throw new MetaException("The update count was " + count + " which is not the expected. Rolling back.");
    }
    LOG.debug("Command <{}> updated {} records.", query, count);
    return count;
  }
Executes a {@link NamedParameterJdbcTemplate#update(String, org.springframework.jdbc.core.namedparam.SqlParameterSource)}
calls using the query string and {@link SqlParameterSource}. Validates the resulted number of affected rows using the
resultpolicy function.

@param query        Parameterized query string.
@param params       Qyery parameters
@param resultPolicy Result policy to use, or null, if no result policy.
@return Returns the number of affected rows.
@throws MetaException Forwarded from {@link ParameterizedCommand#getParameterizedQueryString(DatabaseProduct)} or
                      thrown if the update count was rejected by the {@link ParameterizedCommand#resultPolicy()} method
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/jdbc/MultiDataSourceJdbcResource.java