Skip to content

Commit 8da2157

Browse files
committed
add support for Instant and Year and clarify JDBC mappings for basic types
see jakartaee#163
1 parent 4daf494 commit 8da2157

File tree

4 files changed

+31
-17
lines changed

4 files changed

+31
-17
lines changed

Diff for: spec/src/main/asciidoc/appendixes.adoc

+2
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ Clarified `SqlResultSetMapping` with multiple ``EntityResult``s and conflicting
106106

107107
Added support for Java record types as embeddable classes
108108

109+
Added support for _java.time.Instant_ and _java.time.Year_ and clarified JDBC mappings for basic types
110+
109111
Added `||` string concatenation operator
110112

111113
Added _getSingleResultOrNull()_ to _Query_, _TypedQuery_, _StoredProcedureQuery_

Diff for: spec/src/main/asciidoc/ch02-entities.adoc

+10-7
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ _java.sql.Date_, _java.sql.Time_, _java.sql.Timestamp_, _byte[]_,
170170
_Byte[]_, _char[]_, _Character[]_, _java.time.LocalDate_,
171171
_java.time.LocalTime_, _java.time.LocalDateTime_,
172172
_java.time.OffsetTime_, _java.time.OffsetDateTime_,
173+
_java.time.Instant_, _java.time.Year_,
173174
and user-defined types that implement the _Serializable_ interface _)_;
174175
enums; entity types; collections of entity types; embeddable classes
175176
(see <<a487>>); collections of basic and embeddable types (see <<a494>>).
@@ -1114,11 +1115,12 @@ public class MedicalHistory {
11141115

11151116
=== Basic Type
11161117

1117-
Basic type is any Java primitive type, wrapper of the primitive types, java.lang.String,
1118-
java.math.BigInteger, java.math.BigDecimal, java.util.Date, java.util.Calendar, java.sql.Date,
1119-
java.sql.Time, java.sql.Timestamp, java.time.LocalDate, java.time.LocalTime,
1120-
java.time.LocalDateTime, java.time.OffsetTime, java.time.OffsetDateTime, byte[], Byte[], char[],
1121-
Character[], enum, any other type that implements Serializable.
1118+
A basic type is any Java primitive type, wrapper of the primitive types, java.lang.String,
1119+
java.math.BigInteger, java.math.BigDecimal, java.util.Date, java.util.Calendar,
1120+
java.sql.Date, java.sql.Time, java.sql.Timestamp, java.time.LocalDate, java.time.LocalTime,
1121+
java.time.LocalDateTime, java.time.OffsetTime, java.time.OffsetDateTime,
1122+
java.time.Instant, java.time.Year, byte[], Byte[], char[], Character[], any enum type,
1123+
any other type that implements Serializable.
11221124

11231125
=== Embeddable Classes [[a487]]
11241126

@@ -1281,8 +1283,9 @@ _java.util.UUID_, _java.util.Date_, _java.util.Calendar_,
12811283
_java.sql.Date_, _java.sql.Time_, _java.sql.Timestamp_,
12821284
_java.time.LocalDate_, _java.time.LocalTime_,
12831285
_java.time.LocalDateTime_, _java.time.OffsetTime_,
1284-
_java.time.OffsetDateTime_, _byte[]_, _Byte[]_, _char[]_,
1285-
_Character[]_, enums, any other type that implements _Serializable_.
1286+
_java.time.OffsetDateTime_, _java.time.Instant_, _java.time.Year_
1287+
_byte[]_, _Byte[]_, _char[]_, _Character[]_, enums,
1288+
any other type that implements _Serializable_.
12861289
See <<a14205>>, <<a14719>>, <<a15087>>, and <<a16361>>.
12871290

12881291
It is an error if no annotation is present

Diff for: spec/src/main/asciidoc/ch11-metadata-for-or-mapping.adoc

+18-9
Original file line numberDiff line numberDiff line change
@@ -538,16 +538,25 @@ _java.util.UUID_, _java.util.Date_, _java.util.Calendar_,
538538
_java.sql.Date_, _java.sql.Time_, _java.sql.Timestamp_,
539539
_java.time.LocalDate_, _java.time.LocalTime_, _java.time.LocalDateTime_,
540540
_java.time.OffsetTime_, _java.time.OffsetDateTime_,
541+
_java.time.Instant_ and _java.time.Year_,
541542
_byte[]_, _Byte[]_, _char[]_, _Character[]_, enums, and any other type
542-
that implements _Serializable_.footnote:[Mapping of
543-
java.time.LocalDate, java.time.LocalTime, java.time.LocalDateTime,
544-
java.time.OffsetTime, and java.time.OffsetDateTime types to columns
545-
other than those supported by the mappings defined by Appendix B of the
546-
JDBC 4.2 specification is not required to be supported by the
547-
persistence provider beyond the support required for other serializable
548-
types. See <<a19496>>.] As described in <<a511>>, the use of the _Basic_
549-
annotation is optional for persistent fields and properties of these
550-
types. If the _Basic_ annotation is not specified for such a field or
543+
that implements _Serializable_.
544+
545+
For the types listed above, the persistence provider must support mappings
546+
to the column types listed in tables B-2 and B-4 of Appendix B of the
547+
JDBC 4.3 specification. See <<a19496>>. In addition, the provider must
548+
support mapping:
549+
550+
- _java.time.Instant_ to the JDBC _TIMESTAMP_ type,
551+
- _java.time.Year_ to the JDBC _INTEGER_ and _SMALLINT_ types,
552+
- _java.math.BigInteger_ and _java.math.BigDecimal_ to the JDBC _NUMERIC_ and _DECIMAL_ types,
553+
- _java.util.UUID_ to the JDBC _CHAR_ and _VARCHAR_ types, and
554+
- _char[]_ to the JDBC _CHAR_, _NCHAR_, _VARCHAR_, _NVARCHAR_, _LONGVARCHAR_,
555+
and _LONGNVARCHAR_ types.
556+
557+
As described in <<a511>>, the use of the _Basic_
558+
annotation is optional for persistent fields and properties of the
559+
types listed above. If the _Basic_ annotation is not specified for such a field or
551560
property, the default values of the _Basic_ annotation will apply.
552561

553562
[source,java]

Diff for: spec/src/main/asciidoc/related-documents.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
- [[[a19493,1]]] Jakarta Persistence, v. 2.2. _https://jakarta.ee/specifications/persistence/2.2/_.
99
- [[[a19494,2]]] SQL 2003, Part 2, Foundation (SQL/Foundation). ISO/IEC 9075-2:2003.
10-
- [[[a19496,3]]] JDBC 4.2 Specification. http://jcp.org/en/jsr/detail?id=221.
10+
- [[[a19496,3]]] JDBC 4.3 Specification. http://jcp.org/en/jsr/detail?id=221.
1111
- [[[a19497,4]]] Enterprise JavaBeans, v. 2.1.
1212
- [[[a19498,5]]] Jakarta Bean Validation, v. 3.0. _https://jakarta.ee/specifications/bean-validation/3.0/_.
1313
- [[[a19499,6]]] Jakarta EE Platform, v. 9.0. _https://jakarta.ee/specifications/platform/9/_.

0 commit comments

Comments
 (0)