Reputation: 13556
I can perform an insertInto().onDuplicateKeyUpdate()
if I want to write my insert manually using the DSL, but is there an equivalent on the generated Record class?
Upvotes: 5
Views: 1196
Reputation: 221106
As of jOOQ 3.7, this is not yet possible out of the box. There's a pending feature request for this: #2961.
Alternatively, you can write a utility that translates an UpdatableRecord
into a corresponding INSERT .. ON DUPLICATE KEY UPDATE
statement. All the meta information needed for this is available from the UpdatableRecord
:
Record.getTable()
to discover the target tableRecord.fields()
to discover all the fields in a recordTable.getPrimaryKey()
primary key information, if you need thatRecord.changed()
flags to discover the modified values of a recordUpvotes: 1