Details
Assignee
UnassignedUnassignedReporter
Former userFormer user(Deactivated)Components
Priority
Major
Details
Details
Assignee
Unassigned
UnassignedReporter
Former user
Former user(Deactivated)Components
Priority
Created December 11, 2019 at 2:06 AM
Updated January 13, 2025 at 1:07 PM
Suppose we have the following:
Currently, Hibernate does not include
InheritedKey#id3
inInheritedKeyEntity
's composite key unlessInheritedKey
is annotated with@MappedSuperclass
.A class used as an
IdClass
does not need any annotations (as opposed to a class used for anEmbeddedId
class, which requires@Embeddable
). Since the class used as anIdClass
does not need to be annotated, it seems kind of strange that its superclass would need to be annotated with@MappedSuperclass
in order for its fields/properties to be persistent. Since the field/property names must match what is annotated in anIdClass
, it is clear that the field/property in a superclass is intended to be included in the ID.The fix for this issue would make annotating the superclass of a class used as an
IdClass
with@MappedSuperclass
optional.If the same embeddable is used as an EmbeddedId, then the embeddable’s superclasses will still require {{@MappedSuperclass}} in order for its properties to be persistent in the EmbeddedId.