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

Support java.time.Instant and java.util.UUID types #693

Open
x80486 opened this issue May 23, 2021 · 2 comments
Open

Support java.time.Instant and java.util.UUID types #693

x80486 opened this issue May 23, 2021 · 2 comments
Assignees

Comments

@x80486
Copy link

x80486 commented May 23, 2021

Description

While testing Doma (and using java.time.Instant and/or java.util.UUID types) I'm always getting error messages like:

[DOMA4096] The class "java.util.UUID" is not supported as a persistent type. If you intend to map the class to the external domain class with @ExternalDomain, the configuration may be not enough. Check the class annotated with @DomainConverters and the annotation processing option "doma.domain.converters".
[DOMA4096] The class "java.time.Instant" is not supported as a persistent type. If you intend to map the class to the external domain class with @ExternalDomain, the configuration may be not enough. Check the class annotated with @DomainConverters and the annotation processing option "doma.domain.converters".

I think these two should be supported out-of-the-box by the framework since they are used widely for id and timestamp fields.

The same goes with java.time.ZonedDateTime.

Implementation Ideas

N/A

@nakamura-to
Copy link
Member

Thanks for your feedback!

We don't support java.time.Instant and java.util.UUID currently because the JDBC specification does not support them.
To support them, we need our own code for each JDBC driver.

We understand that there are situations where you want to use java.util.UUID.

However, we don't know when to use java.time.Instant, because you can use more specific types such as java.time.LocalTime, java.time.LocalDate and java.time.LocaDateTime. Let me know the situations where java.time.Instant is convenient.

@x80486
Copy link
Author

x80486 commented Feb 12, 2024

Instant can be used in those types that store the time-zone, but it's not a standard JDBC type.

OffsetDateTime is a standard JDBC type, and what's used instead — although I find Instant way more intuitive.

UUID could be supported in those engines that supports it. Not sure if there is a way to cherry pick that functionality.

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