You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/src/main/asciidoc/introduction/Mapping.adoc
+21-3Lines changed: 21 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -828,7 +828,7 @@ Here we summarize the ones we've just seen in the second half of this chapter, a
828
828
| `@Collate` | Specify a collation for a column
829
829
|===
830
830
831
-
In addition, there are some configuration properties which have a _global_ affect on how basic types map to SQL column types:
831
+
In addition, there are link:{doc-javadoc-url}org/hibernate/cfg/MappingSettings.html[some configuration properties] which have a _global_ affect on how basic types map to SQL column types:
832
832
833
833
.Type mapping settings
834
834
[%autowidth.stretch]
@@ -841,9 +841,25 @@ In addition, there are some configuration properties which have a _global_ affec
841
841
| `hibernate.type.preferred_duration_jdbc_type` | Specify the default SQL column type for mapping `Duration`
842
842
| `hibernate.type.preferred_instant_jdbc_type` | Specify the default SQL column type for mapping `Instant`
843
843
| `hibernate.timezone.default_storage` | Specify the default strategy for storing time zone information
844
-
| `` |
845
844
|===
846
845
846
+
For example, if we wanted to store an `Instant` using `timestamp with time zone` (called `timestamp` on MySQL, and `datetimeoffset` on SQL Server) instead of `timestamp` (`datetime` on MySQL, `datetime2` on SQL Server), then we could annotated every field of type `Instant`:
847
+
848
+
[source,java]
849
+
----
850
+
@JdbcTypeCode(SqlTypes.TIMESTAMP_WITH_TIMEZONE)
851
+
Instant instant;
852
+
----
853
+
854
+
Alternatively, we could affect every field of type `Instant` with the property `hibernate.type.preferred_instant_jdbc_type`:
0 commit comments