Skip to content
Advertisement

Unable to create records using custom generator strategy for getter names

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.

JavaScript

If I print the record, it looks like this:

JavaScript

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:

JavaScript

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:

JavaScript

Advertisement

Answer

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.

Advertisement