protected Collection<PreparedStatement> createStatements(boolean withKeys) throws SQLException {
        boolean addBatches = !configuration.getUseLiterals();
        Map<String, PreparedStatement> stmts = new HashMap<>();

        // add first batch
        listeners.preRender(context);
        SQLSerializer serializer = createSerializer();
        serializer.serializeMerge(metadata, entity,
                batches.get(0).getKeys(), batches.get(0).getColumns(),
                batches.get(0).getValues(), batches.get(0).getSubQuery());
        context.addSQL(createBindings(metadata, serializer));
        listeners.rendered(context);

        PreparedStatement stmt = prepareStatementAndSetParameters(serializer, withKeys);
        stmts.put(serializer.toString(), stmt);
        if (addBatches) {
            stmt.addBatch();
        }

        // add other batches
        for (int i = 1; i < batches.size(); i++) {
            SQLMergeBatch batch = batches.get(i);
            serializer = createSerializer();
            serializer.serializeMerge(metadata, entity,
                    batch.getKeys(), batch.getColumns(), batch.getValues(), batch.getSubQuery());
            stmt = stmts.get(serializer.toString());
            if (stmt == null) {
                stmt = prepareStatementAndSetParameters(serializer, withKeys);
                stmts.put(serializer.toString(), stmt);
            } else {
                setParameters(stmt, serializer.getConstants(), serializer.getConstantPaths(), metadata.getParams());
            }
            if (addBatches) {
                stmt.addBatch();
            }
        }

        return stmts.values();
    }
Execute the clause and return the generated keys as a ResultSet

@return result set with generated keys
querydsl-sql/src/main/java/com/querydsl/sql/dml/SQLMergeClause.java