INSERT ... RETURNING when doing CRUD with Record objects

Fri, 29 Mar 2019 20:46:49 -0700

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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to