Skip to content

Commit

Permalink
move and rewrite list of allowed attribute types
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinking committed Dec 10, 2023
1 parent 95a9ee1 commit 98efa30
Showing 1 changed file with 20 additions and 25 deletions.
45 changes: 20 additions & 25 deletions spec/src/main/asciidoc/ch02-entities.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@ visibility, independent of whether field access or property access is used.
When property access is used, the property accessor methods must be public
or protected.

The type of a persistent field or property of an entity class may be:

- any basic type listed below in <<a486>>, including any Java `enum` type,
- an entity type or a collection of some entity type, as specified in <<a516>>,
- an embeddable class, as defined in <<a487>>, or
- a collection of a basic type or embeddable type, as specified in <<a494>>.

Object/relational mapping metadata may be specified to customize the
object/relational mapping and the loading and storing of the entity state
and relationships, as specified in <<a13915>>.

The placement of object/relational mapping annotations depends on whether
property access or field access is used:

Expand Down Expand Up @@ -171,28 +182,6 @@ from a superclass. However, portable applications must not override
the object/relational mapping metadata applied to the persistent fields
and properties of entity superclasses.

The persistent fields or properties of an entity may be of the following
types: Java primitive types, `java.lang.String`, other Java serializable
types (including wrappers of the primitive types, `java.math.BigInteger`,
`java.math.BigDecimal`, `java.util.UUID`, `java.util.Date`,
`java.util.Calendar`,footnote:[Note that an instance of `Calendar` must be
fully initialized for the type that it is mapped to.]
`java.sql.Date`, `java.sql.Time`, `java.sql.Timestamp`,footnote:[The use
of `java.util.Calendar` or of `java.util.Date` and its subclasses in the
package `java.sql` is strongly discouraged. Newly-written programs should
use date/time types from the package `java.time`.]
`byte[]`, `Byte[]`, `char[]`, `Character[]`, `java.time.LocalDate`,
`java.time.LocalTime`, `java.time.LocalDateTime`,
`java.time.OffsetTime`, `java.time.OffsetDateTime`,
`java.time.Instant`, `java.time.Year`,
and user-defined types that implement the `Serializable` interface);
enums; entity types; collections of entity types; embeddable classes
(see <<a487>>); collections of basic and embeddable types (see <<a494>>).

Object/relational mapping metadata may be specified to customize the
object/relational mapping and the loading and storing of the entity state
and relationships. See <<a13915>>.

==== Example

[source,java]
Expand Down Expand Up @@ -1180,7 +1169,7 @@ public class MedicalHistory {
}
----

=== Basic Type [[a486]]
=== Basic Types [[a486]]

The following Java types are considered _basic types_:

Expand All @@ -1191,8 +1180,14 @@ The following Java types are considered _basic types_:
- `LocalDate`, `LocalTime`, `LocalDateTime`,
`OffsetTime`, `OffsetDateTime`,
`Instant`, or `Year` from `java.time`,
- `Date` or `Calendar` from `java.util`,
- `Date`, `Time`, or `Timestamp` from `java.sql`,
- `Date` or `Calendar` footnote:[Note that an instance of `Calendar` must be
fully initialized for the SQL type it maps.] from `java.util` footnote:[The
use of `java.util.Calendar` or of `java.util.Date` is strongly discouraged.
Newly-written programs should use the date/time types defined in the package
`java.time`.],
- `Date`, `Time`, or `Timestamp` from `java.sql` footnote:[The use of date/time
types defined in the package `java.sql` is strongly discouraged. Newly-written
programs should use the date/time types defined in `java.time`.],
- `byte[]` or `Byte[]`, `char[]` or `Character[]`,
- any Java `enum` type,
- any other type which implements `java.io.Serializable`.
Expand Down

0 comments on commit 98efa30

Please sign in to comment.