Specifying Entity Inheritance


An entity may inherit properties from other entities. You can specify a specific strategy to use for inheritance.

Use this procedure to specify inheritance for an existing entity (@Entity):

  1. Select the entity in the Package Explorer.

  2. In the Persistence Properties view, click the Inheritance tab.

    Specifying Inheritance

    Selecting entity persistence on the Persistence Properties view.
  3. Select one of the following the inheritance strategies:

    • A single table (default)

    • Joined table

    • One table per class

    See "Inheritance Tab" for additional details.

Eclipse adds the following annotations the entity field:

@Inheritance(strategy=InheritanceType.<INHERITANCE_STRATEGY>)

The following figures illustrates the different inheritance strategies.

Single Table Inheritance


Joined Table Inheritance

This figure shows a sample joined inheritance table strategy.

 

Related reference

 

Related task

Adding Persistence to a Class

 

Related concept

Understanding Java Persistence