Generate OffsetDateTime type in jOOQ Metamodel (for Postgres) does not work

126 Views Asked by At

I am using: Jooq 3.16.10, Java 11, Spring boot 2.6.7 and Postgres 14 and a maven plugin for jOOQ. I generate the metamodel from Postgres. The DDL looks like this:

CREATE TABLE IF NOT EXISTS table (
....
     "id" uuid,
     "created_datetime" TIMESTAMP WITH TIME ZONE,
....
);

and in my plugin configuration I have this:

<generator>
           <name>org.jooq.codegen.KotlinGenerator</name>
           <generate>
                    <pojosAsKotlinDataClasses>true</pojosAsKotlinDataClasses>
                    <javaTimeTypes>true</javaTimeTypes>
           </generate>
...

I expect to have OffsetDateTime for "created_datetime" in the Metamodel, yet I get LocalDateTime. What is wrong? I read that <javaTimeTypes>true</javaTimeTypes> suffices for a DB column of type TIMESTAMP WITH TIME ZONE to have a corresponding Metamodel field be OffsetDateTime (a type with a time zone). Can anyone help?

EDIT: that is the code generation:

<plugin>
    <groupId>org.jooq</groupId>
    <artifactId>jooq-codegen-maven</artifactId>
    <version>3.16.10</version>
    <executions>
        <execution>
            <goals>
                <goal>generate</goal>
            </goals>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>com.amazonaws.secretsmanager</groupId>
            <artifactId>aws-secretsmanager-jdbc</artifactId>
            <version>1.0.8</version>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>42.3.3</version>
        </dependency>
    </dependencies>
    <configuration>
        <jdbc>
   .....
        </jdbc>
        <generator>
            <name>org.jooq.codegen.KotlinGenerator</name>
            <generate>
                <pojosAsKotlinDataClasses>true</pojosAsKotlinDataClasses>
                <javaTimeTypes>true</javaTimeTypes>
            </generate>
            <database>
                <name>org.jooq.meta.postgres.PostgresDatabase</name>
                <includes>MYTABLE</includes>
                <inputSchema>public</inputSchema>
            </database>
            <target>
                <packageName>tech.ringieraxelspringer.enrichmentapi.infrastructure.job.rds.jooq</packageName>
                <directory>${project.basedir}/src/main/java</directory>
            </target>
        </generator>
    </configuration>
</plugin>
0

There are 0 best solutions below