Unable to create records using custom generator strategy for getter names

Tags: , , ,

I’m on jOOQ 3.13.1, dropwizard 2.0.7. To make jOOQ and dropwizard together, I am using (https://droptools.bendb.com/jooq/). I am using custom generation strategy to maintain camel case for my setters and getters. The names are coming in as expected.

The record objects have data for their respective columns. However, I keep on getting errors from my database that I am trying to set “null” on a non-null column.

I see this issue only when I am trying to create a new record. Updating records work just fine.

ERROR [2021-03-18 14:58:05,363] com.bendb.dropwizard.jooq.jersey.LoggingDataAccessExceptionMapper: Error handling a request: 9f65c0316d996ebb
! org.postgresql.util.PSQLException: ERROR: null value in column "createdAt" of relation "failures" violates not-null constraint
!   Detail: Failing row contains (265, null, Some callback, User account not found, null, null, null).

If I print the record, it looks like this:

|    id|userId|action        |error                                             |createdAt                     |updatedAt                     |status|
|{null}|{null}|*Some callback|*User account not found|*2021-03-18 14:58:05,363|*2021-03-18 14:58:05,363|{null}|

My getter names are: “getId”, “getUserId”, “getAction”, “getError”, “getCreatedAt”, “getUpdatedAt”, “getStatus”.

For columns that are in lowercase, I see no issues. The issue if for places where the column names are in CamelCase.

The class looks something like:

public class FailureDao {

  private final DSLContext database;

  public FailureDao(DSLContext database) {
    this.database = database;

  public void storeFailure(FailureRecord failure) {
    database.newRecord(FAILURES, failure).store();

For code generation, I am following the documentation here https://www.jooq.org/doc/3.13/manual/code-generation/codegen-generatorstrategy/

My generator class looks something like:

public class AsInDatabaseStrategy extends DefaultGeneratorStrategy {

  public String getJavaIdentifier(Definition definition) {
    return definition.getOutputName().toUpperCase();

  public String getJavaSetterName(Definition definition, Mode mode) {
    return "set" + StringUtils.toUC(definition.getOutputName());

  public String getJavaGetterName(Definition definition, Mode mode) {
    return "get" + StringUtils.toUC(definition.getOutputName());


I found the issue. Turns out, it was explained on https://groups.google.com/g/jooq-user/c/1iy0EdWe_T8/m/YN9PEsIF4lcJ. My workaround was to use a jOOQ generated POJO. To create a new record, instead of passing an object of Record class, I am now passing an object of the POJO class.

Source: stackoverflow