Matthias.Frank (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=63119c9...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiMDRkZjE0MGNl...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-15474?atlOrigin=eyJpIjoiMDRkZj...
) HHH-15474 (
https://hibernate.atlassian.net/browse/HHH-15474?atlOrigin=eyJpIjoiMDRkZj...
) Calendar might be written with wrong values (
https://hibernate.atlassian.net/browse/HHH-15474?atlOrigin=eyJpIjoiMDRkZj...
)
Issue Type: Bug Affects Versions: 5.3.13 Assignee: Unassigned Components: hibernate-core
Created: 01/Sep/2022 23:22 PM Environment: java 1.8; usage of mixed timezones
(client%server application). Priority: Major Reporter: Matthias.Frank (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=63119c9...
)
Hello,
when writing Calendar values we experienced, that all values are written in the wrong
timezone to the database. All values were shifted by an offset, which is related to the
original timezone of the Calendar object. This behavior is critical, since we can’t
control by 100% the Calendar values by ourself. We tried to use the jdbcTimeZone settings
as well the user.timeZone setting - nothing worked for use.
The root cause is related to the TimestampTypeDescriptor (getBinder, doBind). In both
methods the Calendar type has a special handling. The configured jdbcTimezon is ignored
and the reference timezon for storing the data is taken from the Calendar object itself.
Based on the nature of the Calendar object, this is critical. As timestamp with timezone
the offset should apply and at least the default timezone should be used. The current
handling is an appraoch, which is correct for local time (LocalDateTime),
Solution: at least the jdbcTimezone should also apply to the Calendar type. If
jdbcTimezone is not specified the configured default timezone should being used as 3rd
parameter for PreparedStatement.setTimeStamp and CallableStatement::setTimestamp.
Thanks a lot for all Your hibernate support and the excellent ORM solution.
Best regards,
Matthias
(
https://hibernate.atlassian.net/browse/HHH-15474#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-15474#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100206- sha1:3ac329d )