@SuppressWarnings("unchecked")
    protected long executeCompositeMerge() {
        if (hasRow()) {
            // update
            SQLUpdateClause update = new SQLUpdateClause(connection(), configuration, entity);
            populate(update);
            addListeners(update);
            addKeyConditions(update);
            return update.execute();
        } else {
            // insert
            SQLInsertClause insert = new SQLInsertClause(connection(), configuration, entity);
            addListeners(insert);
            populate(insert);
            return insert.execute();

        }
    }
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