HHH-16035 document Duration -> NUMERIC mapping

This commit is contained in:
Gavin 2023-01-13 11:23:14 +01:00 committed by Gavin King
parent 6f7b17d36b
commit 6ca9643c72
2 changed files with 4 additions and 2 deletions

View File

@ -85,7 +85,7 @@ in <<basic-custom-type>>.
[cols="<.^,<.^,<.^,<.^",options="header",]
|=================================================================================================
|Hibernate type (org.hibernate.type package) |JDBC type |Java type |BasicTypeRegistry key(s)
|DURATION |INTERVAL_SECOND |java.time.Duration |Duration, java.time.Duration
|DURATION |NUMERIC |java.time.Duration |Duration, java.time.Duration
|INSTANT |TIMESTAMP_UTC |java.time.Instant |Instant, java.time.Instant
|LOCAL_DATE_TIME |TIMESTAMP |java.time.LocalDateTime |LocalDateTime, java.time.LocalDateTime
|LOCAL_DATE |DATE |java.time.LocalDate |LocalDate, java.time.LocalDate

View File

@ -980,7 +980,9 @@ include::{sourcedir}/basic/BlobByteArrayTest.java[tags=basic-blob-byte-array-exa
==== Duration
By default, Hibernate will map `Duration` to the `INTERVAL_SECOND` SQL type and fallback to `NUMERIC` if necessary.
By default, Hibernate maps `Duration` to the `NUMERIC` SQL type.
TIP: It's possible to map `Duration` to the `INTERVAL_SECOND` SQL type using `@JdbcType(INTERVAL_SECOND)` or by setting `hibernate.type.preferred_duration_jdbc_type=INTERVAL_SECOND`
[[basic-duration-example]]
.Mapping Duration