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 <m...@providencehr.com>:

> 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 the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jooq-user+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to