Hello, Can you please show the full stack trace? I suspect you ran into this issue, which is fixed for jOOQ 3.5 and will be merged to 3.4.3 soon: https://github.com/jOOQ/jOOQ/issues/3427
If you're using the ExceptionTranslator as suggested in the jOOQ / Spring tutorial ( https://github.com/jOOQ/jOOQ/tree/master/jOOQ-examples/jOOQ-spring-example), then you could either remove that translator, or patch it like this: public class ExceptionTranslator extends DefaultExecuteListener { /** * Generated UID */ private static final long serialVersionUID = -2450323227461061152L; @Override public void exception(ExecuteContext ctx) { if (ctx.exception() instanceof org.jooq.exception.ControlFlowSignal) return; SQLDialect dialect = ctx.configuration().dialect(); SQLExceptionTranslator translator = (dialect != null) ? new SQLErrorCodeSQLExceptionTranslator(dialect.name()) : new SQLStateSQLExceptionTranslator(); ctx.exception(translator.translate("jOOQ", ctx.sql(), ctx.sqlException())); } } Let me know if this helps, Lukas 2014-09-03 14:56 GMT+02:00 Gokul Krishna Paravasthu <[email protected]>: > Hi, > > I have a postgres table which has an autogenerated primary key and some > other columns. > i have used jooq's code generator to create generate a record class for > this table. > creating a new record and inserting it using record.insert works fine > without setting a value for the autogenerated key. > if i create a list of records and use DSL.batchInsert i get a "cannot > translate a null" exception. > > SampleRecord r = new SampleRecord(); > // set only col1 and not the autogenerated primary key > r.setCol1(0); > r.attach(config); > r.insert(); // this works fine > > Set<SampleRecord> rs = new HashSet<>(); > > SampleRecord r1 = new SampleRecord(); > r1.setCol1(1); > r1.attach(config); > rs.add(r1); > > > SampleRecord r2 = new SampleRecord(); > r2.setCol1(2); > r2.attach(config); > rs.add(r2); > > dslContext.batchInsert(rs).execute(); // this throws a "cannot translate > null exception" > > > Thanks, > Gokul > > -- > 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.
