Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revise restrictions on entity/embeddable classes and primary key classes #428

Merged
merged 2 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion spec/src/main/asciidoc/appendixes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,8 @@ Added _concat()_ overload accepting list of expressions to _CriteriaBuilder_

Made the _name_ member of _TableGenerator_ and _SequenceGenerator_ optional

Pulled _getParameters()_ up from _CriteriaQuery_ to _CommonAbstractCriteria_
Entity and embeddable classes may now be static inner classes

Primary key classes are no longer required to be public and serializable

Pulled _getParameters()_ up from _CriteriaQuery_ to _CommonAbstractCriteria_
15 changes: 7 additions & 8 deletions spec/src/main/asciidoc/ch02-entities.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The entity class must have a no-arg
constructor. The entity class may have other constructors as well. The
no-arg constructor must be public or protected.

The entity class must be a top-level class.
The entity class must be a top-level class or a static inner class.
An enum, record, or interface may not be designated as an entity.

The entity class must not be final. No
Expand Down Expand Up @@ -416,10 +416,10 @@ property, the temporal type should be specified as _DATE_.
The following rules apply for composite
primary keys:

- The primary key class may be a regular Java class, in which case it must
be public and must have a public no-arg constructor. Alternatively, it may
be a public Java record type, in which case it need not have a no-arg
constructor.
- The primary key class may be a non-abstract regular Java class with a
no-arg constructor. The no-arg constructor must be public or protected.
Alternatively, the primary key class may be any Java record type, in
which case it need not have a no-arg constructor.

- The access type (field- or property-based
access) of a primary key class is determined by the access type of the
Expand All @@ -429,8 +429,6 @@ embedded id and a different access type is specified. See Section <<a113>>.
- If property-based access is used, the
properties of the primary key class must be public or protected.

- The primary key class must be serializable.

- The primary key class must define _equals_
and _hashCode_ methods. The semantics of value equality for these
methods must be consistent with the database equality for the database
Expand Down Expand Up @@ -1140,7 +1138,8 @@ for an embedded object is determined as described in <<a113>>.

An embeddable class may be a regular Java class which adheres to the
requirements specified in <<a18>> for entities, with the exception that
an embeddable class is not annotated as _Entity_.
an embeddable class is not annotated as _Entity_, and an embeddable
class may not be abstract.

Alternatively, an embeddable class may be any Java record type.

Expand Down