New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
timezones are not handled in DefaultBinding #5504
Comments
Nope, never mind, there was some wrapper code in our project I had missed that was causing the issue. |
I'm going to reopen this, after a lot of being confused this was actually the cause of my issue. Implementing a binding that provides a correct calendar results in the correct values. I think that it is probably specific to PG. To clarify what is causing the issue, PG's timezone is set to Australia/Victoria, my laptop's TZ is set to America/Toronto. Before running our testsuite I'm setting the joda, jdk default timezones and the PG session timezone to Europe/Berlin:
This results in Timestamps and Dates being fetched incorrectly. Adding a specific binding for dates and timestamps with a calendar (that has it's timezone updated in the above method) passed into those methods fixes the issue.
The bindings that work:
|
I'll also note that in the bindings above the DateTime one works here as it writes the joda DateTime to the DB rather than the jdk Timestamp. The DefaultBinding would need to manually append the timezone info from the Calendar to the Timestamp when writing to a |
It seems that we encountered the same problem in an Oracle DB. |
I must admit that we have already a custom DateTimeBinding for "TIMESTAMP WITH TIMEZONE" in place, but it's not working correctly... |
Indeed, the I'm hoping this will be part of jOOQ 3.9 |
@chwassme i thought the oracle driver uses the stream api which doesn't accept a tz. I think you would have to manually fix the offset in the binding. |
The more I think about this, I think that jooqs timestamp with timezone datatype should target either String, OffsetDateTime or some jooq specific type wrapping both the Timestamp and Timezone. The way it is at the moment there's no way to recover the lost information. You can still get the correct time by setting the session tz (in pg anyway) or converting to utc or something in the db before sending it but imo that's not a great solution. It would be better if it 'just worked' out of the box |
now I am using 3.11.11, code generated with |
Thank you for your comment. I'm not sure this is related. This issue here is not about code generation. Would you mind creating a new issue with some more details (including the DDL of the table, the full code generation configuration)? |
When setting and getting timestamps, times and dates from the result set
DefaultBinding
calls:rather than
As a result the timezone offset is not accounted for and the retrieved value is incorrect.
This might be a PG only issue.
jooq pro 3.8.3
postgresql 9.5.5
oracle java 1.8.0_92
OSX
The text was updated successfully, but these errors were encountered: