Introduce Java types for SQL Interval types #4892
beikov
started this conversation in
Design Proposals
Replies: 2 comments 2 replies
-
According to our existing ideology, this wouldn’t belong in core, but in something analogous to hibernate-spatial or that hibernate types project i have never looked at. Of course, ideology can change… |
Beta Was this translation helpful? Give feedback.
0 replies
-
I propose we add a new sub module to Hibernate for these things and propose the module name |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
The SQL Standard has
interval X
andinterval X to Y
types, which can be seen as wrappers aroundnumeric
where theY
part is the fractional part. I propose to add Java types to Hibernate for these interval types, which extendjava.lang.Number
. These special types will receive some methods to interact withTemporal
types and map to the corresponding SQLinterval
types, ornumeric
/decimal
as fallback.Since Oracle only supports 2 interval types, I would suggest we limit ourselves to these for now:
YearToMonthInterval
forinterval year to month
DayToSecondInterval
forinterval day to second
for a precision up to nanosecondsWe can add others later though if needed and emulate these through the
numeric
type then.As a side note, we already support the type
interval second
whichjava.time.Duration
maps to if possible.Beta Was this translation helpful? Give feedback.
All reactions