# 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 (`@Inheritance)` for an existing entity (`@Entity`):

1. Select the entity in the Package Explorer.

2. In the JPA Details view, select the Inheritance information.

   Specifying Inheritance

3. In the Strategy list, select one of the following the inheritance strategies:

   - A single table (default)

   - Joined table

   - One table per class

4. Use the following table to complete the remaining fields on the tab. See "Inheritance information" for additional details.

   Property | Description | Default
   --- | --- | ---
   Discriminator Column | Name of the discriminator column when using a Single or Joined inheritance strategy. This field corresponds to the `@DiscriminatorColumn` annotation. |
   Discriminator Type | Set the discriminator type to `Char` or `Integer` (instead of its default: `String`). The Discriminator Value must conform to this type. | String
   Discriminator Value | Specify the discriminator value used to differentiate an entity in this inheritance hierarchy. The value must conform to the specified Discriminator Type. This field corresponds to the `@DiscriminatorValue` annotation. |
   Override Default | Use this field to specify custom primary key join columns. This field corresponds to the `@PrimaryKeyJoinClumn` annotation. |

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.

Single Table Inheritance

Joined Table Inheritance

Adding persistence to a class

Understanding Java persistence