Where to define @IdClassannotation in both scenarios?
@IdClass
In my view for case 1: both Entity1 and Entity2 should have their own @IdClass.
since Entity2 also has a primary key.
and for case 2: MapedSuperClass2 should have @IdClass.
since both Entity1 and Entity2 use the same primary key.
I'm right?
Case 1:
Case 2:
In the first scenario, when you define an IdClass in a parent class, you cannot add or even delete key fields in subclasses, so adding a new value to a key in Entity2 is not allowed by the specification.
@IdClass MapperSuperClass, , , , .