1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[SQL] jOOQ sets timestamps with local time zone when UTC was expected

Discussão em 'Outras Linguagens' iniciado por Stack, Outubro 3, 2024 às 13:43.

  1. Stack

    Stack Membro Participativo

    In my jOOQ configuration file I have this line:

    <javaTimeTypes>true</javaTimeTypes>


    If I create this table in HSQLDB:

    CREATE TABLE T1 (C1 TIMESTAMP DEFAULT NOW() ON UPDATE CURRENT_TIMESTAMP NOT NULL);


    The generated jOOQ code is like this:

    public final TableField<T1Record, LocalDateTime> C1 =
    createField("C1", org.jooq.impl.SQLDataType.LOCALDATETIME.nullable(false).
    defaultValue(org.jooq.impl.DSL.field("LOCALTIMESTAMP",
    org.jooq.impl.SQLDataType.LOCALDATETIME)), this, "");


    My JVM starts with the CET time zone and, no matter if I set it or not to GMT before creating the DSLContext, when inserting or updating rows (without setting a value explicitly) jOOQ always uses the CET time zone.

    When using JDBC directly timestamps are inserted in GMT, which is what I want.
    How can I configure jOOQ to have the same effect?

    I'm checking the database contents with IntelliJ IDEA.

    Continue reading...

Compartilhe esta Página