Lee Crabtree :
Using jooq 3.11.8, referencing a constraint in an onConflictOnConstraint
is not particularly discoverable, and the documentation is exactly no help. I know the name of the constraint, but onConflictOnConstraint
doesn't take a String
.
Specifically:
ctx.insertInto(
TABLE,
TABLE.ID,
TABLE.FIELD1
)
.values(
id,
value
)
.onConflictOnConstraint(/* WHAT GOES HERE? */)
.doUpdate()
.set(TABLE.FIELD1, value)
.execute();
What am I missing?
Lukas Eder :
There are 3 overloads of this method:
onConflictOnConstraint(Constraint)
: Use this with constraints defined throughDSL.constraint()
, i.e. the DDL APIonConflictOnConstraint(Name)
: Use this withDSL.name()
, a way to create ad hoc identifier referencesonConflictOnConstraint(UniqueKey)
: Use this with generatedUniqueKey
references in generated tables, e.g. as obtained fromTable.getPrimaryKey()