I need to insert a large number of rows into MySQL database and if they are duplicate, just update columns.
This is what I have:
dslContext .insertInto( USER, USER.ID, USER.NAME ) .valuesOfRows( profiles .stream() .collect( toRowArray( x -> DSL.val(x.getId()) x -> DSL.val(x.getName()) ) ) ) .onDuplicateKeyUpdate() .set(USER.NAME, ???) .execute(); How should I handle duplicates in this case? The JooQ documentation's example is set(AUTHOR.LAST_NAME, "Koontz") which uses a fixed value to update. But here many rows are being inserted. How can I tell jooq "if row is a duplicate, just update user name?"