You're right, there is currently no reference to the support of the DEFAULT and DEFAULT VALUES clauses in the manual. I have registered an issue to fix this: https://github.com/jOOQ/jOOQ/issues/3417
Essentially, this is how it works for DEFAULT VALUES: DSL.using(configuration) .insertInto(TABLE) .defaultValues() .execute(); ... and for DEFAULT: DSL.using(configuration) .insertInto(TABLE, TABLE.COL1, TABLE.COL2) .values(1, DSL.defaultValue(TABLE.COL2.getType())) .execute(); DSL.using(configuration) .update(TABLE) .set(TABLE.COL2, DSL.defaultValue(TABLE.COL2.getType())) .where(TABLE.COL1.eq(1)) .execute(); Note that a data type has to be supplied to DSL.defaultValue(), otherwise the type Field<Object> is returned, which cannot be used typesafely with values() or set(). Hope this helps, Lukas 2014-07-17 19:58 GMT+02:00 <[email protected]>: > I would like to use this new feature, but I can't seem to find any > examples or documentation on how to use it. > > It would be super helpful for me if someone could post an example of an > insertInto statement using a default value for a column. > > > > On Wednesday, May 7, 2014 3:43:57 AM UTC-6, Lukas Eder wrote: >> >> >> >> >> 2014-04-14 19:35 GMT+02:00 Garret Wilson <[email protected]>: >> >> On Monday, April 14, 2014 2:11:46 PM UTC-3, Lukas Eder wrote: >>>> >>>> ... >>>> This is only a matter of finding a meaningful way to name the DSL >>>> method, as "default" is a keyword in Java and cannot be used. >>>> >>> >>> defaultValue() springs to mind... >>> >> >> This issue has now been implemented for jOOQ 3.4: >> https://github.com/jOOQ/jOOQ/issues/1061 >> >> defaultValue() was indeed the best choice here, as it works well with >> the existing defaultValues(), which can be used on INSERT statements. >> > -- > 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.
