I am using mvn liquibase:diff
to generate the changests with the differences between my spring entities and the database.
Everything works fine except when I am using the ZonedDateTime
type.
mvn liquibase:diff
generates a changeset with TIMESTAMP WITHOUT TIME ZONE
, but it should be generating a TIMESTAMP WITH TIME ZONE
. How can I specify that the mapping must be ZonedDateTime → TIMESTAMP WITH TIME ZONE
, and LocalDateTime → TIMESTAMP WITHOUT TIME ZONE
.
P.S. I am using PosgreSQL database. Thank you.
I am expecting that the mapping must be ZonedDateTime → TIMESTAMP WITH TIME ZONE
, and LocalDateTime → TIMESTAMP WITHOUT TIME ZONE
.
No, not
ZonedDateTime
ZonedDateTime
is not defined in the JDBC mapping of Java classes to SQL types.OffsetDateTime
OffsetDateTime
is the class to use with a column of a type akin to the SQL standard typeTIMESTAMP WITH TIME ZONE
. See JDBC 4.2 specification.OffsetDateTime
LocalDateTime
You said:
No, it should not.
Only
OffsetDateTime
is mapped toTIMESTAMP WITH TIME ZONE
in JDBC. The other two classes that represent a specific point on the timeline are not mapped in JDBC:Instant
&ZonedDateTime
.The SQL Standard unfortunately used the word time zone, but actually meant offset from UTC.