hibernate-orm/design/doc-temporal.adoc
Steve Ebersole eab6107ec2 HHH-13785 : HQL/Criteria function support
- temporal literals
- generalized literals
- literal formatters (SQL string generation)
- FORMAT function
2020-01-06 08:38:08 -06:00

11 lines
701 B
Plaintext

`OffsetDateTime` is not safe to store in database. This form does not understand "zone rules" relating to things
such as DST. An offset of +5, e.g., does not change when DST starts/ends - its just +5.
A `ZonedDateTime` on the other hand knows the actual timezone as well as the offset for the LocalDateTime portion in
that timezone. It is much more complete picture of the actual Instant.
The proper solution for storing "with tz" would be to always use a `ZonedDateTime`, converted from `OffsetDateTime`
if needed. In this case, I assume we need to transform a `LocalDateTime` to `ZonedDateTime`?
^^ what about Dialects that do not support "with tz" datatype variants? Are there any anymore?