Search code examples
javapostgresqljooq

jOOQ ignores column name casing when generation code from Postgresql table


I'm using jOOQ 3.10.1 with Postgres JDBC driver 42.1.4 and trying to generate code for following table:

create table "SampleTable"(
    "ID" serial primary key,
    "AnotherField" integer
);

jOOQ generates following code:

public interface ISampletable extends Serializable {
    public Integer getId();
    public Integer getAnotherfield();
//...

How can i configure jOOQ to generate case-sensitive code?


Solution

  • By default, jOOQ's code generator follows Java's code style:

    • classes are generated in PascalCase
    • members and methods are generated in camelCase
    • identifiers are generated in UPPER_CASE_WITH_UNDERSCORE

    But you can override this behaviour easily using a generator strategy. There are two flavours:

    In your case, the configurative approach might do, or you can simply use the built-in org.jooq.codegen.KeepNamesGeneratorStrategy.