Hi Ben, Yes indeed, thanks for documenting this additional workaround. Another workaround would be to cast the type you got prior to the returning() call to InsertReturningStep.
This API flaw is already fixed for the upcoming jOOQ 3.10: https://github.com/jOOQ/jOOQ/issues/2123 Thanks, Lukas 2017-05-06 3:33 GMT+02:00 <[email protected]>: > It would be nice if the DSL supported the returning() step on a conflict > update. This would look like, > > return create.insertInto(table, field1, field2) > .values(value1, value2) > .values(value3, value4); > .onDuplicateKeyUpdate() > .set(field1, value1) > .set(field2, value2) > .returning() > .fetchOne(); > > Instead the operation has to be broken up into a few statements, > > insert = create.insertInto(table, field1, field2) > .values(value1, value2) > .values(value3, value4); > insert.onDuplicateKeyUpdate() > .set(field1, value1) > .set(field2, value2) > return insert.returning().fetchOne(); > > The resulting SQL query is perfect, but it may not be obvious to some > users that they can chain operations out of order. > > -- > You received this message because you are subscribed to the Google Groups > "jOOQ User Group" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
