Module org.jooq
Package org.jooq

Interface InsertOnDuplicateStep<R extends Record>

All Superinterfaces:
Attachable, AttachableQueryPart, AutoCloseable, Flow.Publisher<Integer>, Insert<R>, InsertFinalStep<R>, InsertReturningStep<R>, Publisher<Integer>, org.reactivestreams.Publisher<Integer>, Query, QueryPart, RowCountQuery, Serializable, Statement
All Known Subinterfaces:
InsertSetMoreStep<R>, InsertValuesStep1<R,​T1>, InsertValuesStep10<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10>, InsertValuesStep11<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11>, InsertValuesStep12<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12>, InsertValuesStep13<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13>, InsertValuesStep14<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14>, InsertValuesStep15<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15>, InsertValuesStep16<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16>, InsertValuesStep17<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16,​T17>, InsertValuesStep18<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16,​T17,​T18>, InsertValuesStep19<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16,​T17,​T18,​T19>, InsertValuesStep2<R,​T1,​T2>, InsertValuesStep20<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16,​T17,​T18,​T19,​T20>, InsertValuesStep21<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16,​T17,​T18,​T19,​T20,​T21>, InsertValuesStep22<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16,​T17,​T18,​T19,​T20,​T21,​T22>, InsertValuesStep3<R,​T1,​T2,​T3>, InsertValuesStep4<R,​T1,​T2,​T3,​T4>, InsertValuesStep5<R,​T1,​T2,​T3,​T4,​T5>, InsertValuesStep6<R,​T1,​T2,​T3,​T4,​T5,​T6>, InsertValuesStep7<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7>, InsertValuesStep8<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8>, InsertValuesStep9<R,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9>, InsertValuesStepN<R>

public interface InsertOnDuplicateStep<R extends Record> extends InsertReturningStep<R>
This type is used for the Insert's DSL API.

Example:

 DSLContext create = DSL.using(configuration);

 create.insertInto(table, field1, field2)
       .values(value1, value2)
       .values(value3, value4)
       .onDuplicateKeyUpdate()
       .set(field1, value1)
       .set(field2, value2)
       .execute();
 

Referencing XYZ*Step types directly from client code

It is usually not recommended to reference any XYZ*Step types directly from client code, or assign them to local variables. When writing dynamic SQL, creating a statement's components dynamically, and passing them to the DSL API statically is usually a better choice. See the manual's section about dynamic SQL for details: https://www.jooq.org/doc/latest/manual/sql-building/dynamic-sql.

Drawbacks of referencing the XYZ*Step types directly:

  • They're operating on mutable implementations (as of jOOQ 3.x)
  • They're less composable and not easy to get right when dynamic SQL gets complex
  • They're less readable
  • They might have binary incompatible changes between minor releases
Author:
Lukas Eder