Skip to content
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

DateTimeSerializerBase doesn't use WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS with java.sql.Timestamp #10

Closed
hadrienk opened this issue Feb 1, 2017 · 3 comments

Comments

@hadrienk
Copy link

hadrienk commented Feb 1, 2017

When converted using DateTimeSerializerBase, java.sql.Timestamp instances are not written in nanoseconds, even if the WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS feature is enabled.

I found this error doing the following:

ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new JavaTimeModule());
mapper.configure(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS, true);
mapper.configure(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS, true);
mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, true);
mapper.convertValue(new Timestamp(1456412409000), Instant.class)

@hadrienk
Copy link
Author

hadrienk commented Feb 1, 2017

I wrote this issue on the databind project by mistake.

@cowtowncoder
Copy link
Member

I am not sure this is possible to implement in backwards compatible manner; although I guess use of floating-point representation might work?

@cowtowncoder
Copy link
Member

Actually support does need to be in jackson-databind so I'll close this, re-open the other one.
I am cautiously positive I'll actually have time to try to implement support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants