Hello Max, You can write an INSERT statement without specifying the target columns with jOOQ, although, jOOQ will try to take those from the table supplied via Table.fields().
I've just noticed that this doesn't work at all with plain SQL tables. I've registered an issue for this: https://github.com/jOOQ/jOOQ/issues/4629 In the meantime, you'll have to specify the column names, I'm afraid... Best Regards, Lukas 2015-10-09 21:58 GMT+02:00 Max Kremer <[email protected]>: > Hello > > I'm trying to insert into a table without specifying table's columns > names which perfectly valid SQL: > > INSERT INTO FOO VALUES ('A', 'B', 500) > > The above will execute without error when the values line up with the > columns in the table. > > How can I accomplish the above with JOOQ? My attempt below doesnt compile > to a cryptic generic error > > InsertValuesStepN<Record> sql = dsl.insertInto(dsl.table("foo")); > > for (...){ > > List<Field<?>> values = Lists.newArrayList(); > > for ( ... ) { > values.add(val("someval", type)); > } > > sql = sql.values(values); > } > > sql.execute(); > > > > > -- > 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.
