Hi Lukas, DSL.using(configuration).execute(CUSTOMER.insert(name, street1, ...));
That's exactly what we're looking for. In particular we want to batch the org.jooq.Insert instances. I'll take a look at your suggestions. What we found was the dirty checking that occurs in the records when using dsl.batchInsert(records) significantly slowed down the process. - Mike Foody Providence HR http://www.providencehr.com (832) 714 1652 [email protected] On Fri, Jul 15, 2016 at 11:23 AM, Lukas Eder <[email protected]> wrote: > Hi Mike, > > Thanks a lot for your feedback. From what I understand, your insert() > method would produce an org.jooq.Insert object, that can be executed in the > context of a Configuration, such as: > > DSL.using(configuration).execute(CUSTOMER.insert(name, street1, ...)); > > > In a way, this already exists via the following API: > > DSL.using(configuration).executeInsert(new CustomerRecord(name, street1, > ...)); > > > Does that respond to your API needs? Now, the question is, how to not > execute the statement, but collect it for later batching... An alternative > API that could be used for this would be: > > DSL.using(configuration).insertInto(CUSTOMER).set(new CustomerRecord(name, > street1, ...)); > > > The set() call isn't type safe, but that might be OK. One more option is > to use the existing Loader API > > DSL.using(configuration) > .loadInto(CUSTOMER) > .loadRecords(new CustomerRecord(name, street1, ...)) > .fields(CUSTOMER.fields()) > .execute(); > > > And finally :) > > > Result<CustomerRecord> result = > DSL.using(configuration).newResult(CUSTOMER); > result.add(new CustomerRecord(name, street1, ...)); > String inserts = result.formatInsert(); > > > These are just some ideas of what's possible today. I'm very happy to > discuss further steps. > > Lukas > > 2016-07-14 23:54 GMT+02:00 <[email protected]>: > >> Hi Lukas, >> >> A generated method to provide a type safe insert statement including all >> the table columns would be extremely useful for us. We typically use >> records to do inserts but for a few high volume processes we are batching >> raw inserts. We found this significantly faster than instantiating records >> and using dsl.batchInsert(). The issue with this is that as our schema >> evolves it's easy to leave columns out of the insert. So for instance if I >> have a table customer, it would be great to be able to do something like >> >> Tables.CUSTOMER.insert(name, street1, ...) >> >> -- > You received this message because you are subscribed to a topic in the > Google Groups "jOOQ User Group" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/jooq-user/7hfDlmEwfQI/unsubscribe. > To unsubscribe from this group and all its topics, 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.
