That works great, thanks! Might not hurt to throw a link to that from the updatable records section of the manual. :) https://www.jooq.org/doc/3.11/manual/sql-execution/crud-with-updatablerecords/simple-crud/ in the Storing, or maybe Refreshing, section seems plausible to me.
On Sunday, March 31, 2019 at 7:36:05 AM UTC-6, Lukas Eder wrote: > > Hi Marshall , > > Maybe this helps: > > https://www.jooq.org/doc/latest/manual/sql-building/dsl-context/custom-settings/settings-return-all-on-store > > The default value for the returnAllOnUpdatableRecord is false, as this is > usually not needed, and it causes an extra query on some RDBMS that do not > support the functionality natively (i.e. an implicit refresh() call) > > Thanks, > Lukas > > On Sat, Mar 30, 2019 at 4:45 AM Marshall Pierce <[email protected] > <javascript:>> wrote: > >> I might be missing something obvious in the UpdatableRecord API, but I >> didn't find a way to emulate INSERT ... RETURNING. Is there a way to do >> that? >> >> As an example, I'd like to mimic this behavior (inserting into a simple >> table that only needs `name` specified): >> >> txnContext.insertInto(WIDGETS, WIDGETS.NAME) >> .values(name) >> .returning() >> .fetchOne() >> >> with this: >> >> txnContext.newRecord(WIDGETS).apply { >> this.name = name >> store() // INSERT >> refresh() // SELECT -- ideally not needed >> } >> >> Without that `refresh()`, the new `WidgetsRecord` doesn't have, for >> instance, its db-populated `createdAt`. >> >> Thanks, >> Marshall >> >> -- >> 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] <javascript:>. >> 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.
