8.12.23 @Inheritance
- Organization of this subsection
(1) Description
This annotation specifies the inheritance mapping strategy used in the inheritance hierarchy of an entity.
@Inheritance is specified in the parent entity class of inheritance hierarchy.
The following are two types of inheritance mapping strategy available with Cosminexus JPA provider:
-
SINGLE_TABLE (single table for each class hierarchy)
-
JOINED (binding subclass strategy)
For details on the inheritance mapping strategy, see 9.13.2 Inheritance mapping strategy.
The applicable target is class.
(2) Element
The following table lists the elements of @Inheritance:
|
Element name |
Optional/Required |
Element description |
|---|---|---|
|
Optional |
This element specifies the type of inheritance mapping strategy. |
The details of attributes that are supported with Cosminexus JPA provider are as follows:
(a) strategy element
- Type
-
InheritanceType
- Description
-
This element specifies the type of inheritance mapping strategy used in an entity.
The following two types of values can be specified:
-
InheritanceType.SINGLE_TABLE: This strategy is used to map all classes in the inheritance hierarchy to a single table.
-
InheritanceType.JOINED: This strategy is used to map the top most (parent class) of the inheritance hierarchy to a single table, and map each subclass with a subclass-specific mapping.
-
- Default value
-
InheritanceType.SINGLE_TABLE