private List<Long> executeTxnInsertBatchAndExtractGeneratedKeys(NamedParameterJdbcTemplate jdbcTemplate, boolean genKeySupport,
                                                                  PreparedStatement ps, boolean batch) throws SQLException {
    
    List<Long> txnIds = new ArrayList<>();
    if (batch) {
      ps.executeBatch();
    } else {
      // For slight performance advantage we do not use the executeBatch, when we only have one row
      ps.execute();
    }
    if (genKeySupport) {
      try (ResultSet generatedKeys = ps.getGeneratedKeys()) {
        while (generatedKeys.next()) {
          txnIds.add(generatedKeys.getLong(1));
        }
      }
    } else {
      txnIds = jdbcTemplate.query("SELECT \"TXN_ID\" FROM \"TXNS\" WHERE \"TXN_STATE\" = :tmpState",
          new MapSqlParameterSource().addValue("tmpState", TXN_TMP_STATE), (rs, rowNum) -> rs.getLong(1));

      jdbcTemplate.update("UPDATE \"TXNS\" SET \"TXN_STATE\" = :newState WHERE \"TXN_STATE\" = :tmpState",
          new MapSqlParameterSource()
              .addValue("newState", TxnStatus.OPEN.getSqlConst())
              .addValue("tmpState", TXN_TMP_STATE));
    }
    return txnIds;
  }
Add min history level entry for each generated txn record
@param jdbcTemplate {@link NamedParameterJdbcTemplate} to use for command execution
@param txnIds new transaction ids
@deprecated Remove this method when min_history_level table is dropped
@throws SQLException ex
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/jdbc/functions/OpenTxnsFunction.java