Skip to content

Commit

Permalink
introduce Persistent Attribute Type section
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinking committed Dec 9, 2023
1 parent 95a9ee1 commit 5d10b3b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions spec/src/main/asciidoc/ch02-entities.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,25 @@ before the entity is made persistent. Once the entity becomes managed
(or detached), subsequent access to the collection must be through the
interface type.

==== Persistent Attribute Type

The enumeration `jakarta.persistence.metamodelAttribute.PersistentAttributeType`
defines a classification of persistent entity attributes: `BASIC` for
basic attributes, `EMBEDDED` for embedded attributes, `ELEMENT_COLLECTION`
for element collections, and `MANY_TO_ONE`, `ONE_TO_ONE`, `ONE_TO_MANY`,
and `MANY_TO_MANY` for associations of the indicated multiplicity.
Each persistent attribute of an entity belongs to exactly one of the
listed types.

It is an error for an attribute of an entity to be annotated with
mapping annotations indicating conflicting persistent attribute types.
For example, an field may not be annotated `@Basic @Embedded`,
`@ManyToOne @ElementCollection`, or `@OneToOne @ManyToMany`. The
persistence provider must detect such contradictory combinations of
mapping annotations and report the error.footnote:[A persistence
provider is permitted--but not required--to accept the combinations
`@Basic @ElementCollection` and `@Embedded @ElementCollection`.]

==== Property Access

When property access is used, persistent properties of the entity class
Expand Down

0 comments on commit 5d10b3b

Please sign in to comment.