An entity may inherit properties from other entities. You can specify a specific strategy to use for inheritance.
Use this procedure to specify inheritance (@Inheritance)
for an existing entity (@Entity
):
Select the entity in the Package Explorer.
In the JPA Details view, select the Inheritance information.
In the Strategy list, select one of the following the inheritance strategies:
A single table (default)
Joined table
One table per class
Use the following table to complete the remaining fields on the tab. See "Inheritance information" for additional details.
Eclipse adds the following annotations the entity field:
@Inheritance(strategy=InheritanceType.<INHERITANCE_STRATEGY>) @DiscriminatorColumn(name="<DISCRIMINATOR_COLUMN>", discriminatorType=<DISCRIMINATOR_TYPE>) @DiscriminatorValue(value-"<DISCRIMINATOR_VALUE>") @PrimaryKeyJoinColumn(name="<JOIN_COLUMN_NAME>", referencedColumnName = "<REFERENCED_COLUMN_NAME>")
The following figures illustrates the different inheritance strategies.