PrimaryKeyClass can now subclass other types than Object.

We dropped the requirement that composite keys may only subclass Object to allow usage with other superclasses such as Java records.

Closes #1126
This commit is contained in:
Mark Paluch
2021-05-06 09:09:02 +02:00
parent 25e5970bf5
commit a60b2c48cf
3 changed files with 4 additions and 16 deletions

View File

@@ -312,7 +312,7 @@ include::../{example-root}/LoginEvent.java[tags=class]
==== Primary Key Class
A primary key class is a composite primary key class that is mapped to multiple fields or properties of the entity.
It is annotated with `@PrimaryKeyClass` and must define `equals` and `hashCode` methods.
It is annotated with `@PrimaryKeyClass` and should define `equals` and `hashCode` methods.
The semantics of value equality for these methods should be consistent with the database equality for the database types to which the key is mapped.
Primary key classes can be used with repositories (as the `Id` type) and to represent an entity's identity in a single complex object.
The following example shows a composite primary key class: