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?
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 recordIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With