Mapped superclass

An entity that extends a Mapped Superclass class inherits the persistent state and mapping information from a superclass. You should use a mapped superclass to define mapping information that is common to multiple entity classes.

A mapped superclass can be:

A mapped superclass cannot be:

A mapped superclass does not have a defined database table. Instead, its mapping information is derived from its superclass. To override the mapping information for a specific subclass, use the @AttributeOverride annotation for that specific class.

A mapped superclass is identified by the @MappedSuperclass annotation.

Use this procedure to add Mapped Superclass persistence to an existing entity:

  1. Open the Java class in the Package Explorer.

  2. Select the class in the JPA Structure view.

  3. In the JPA Details view, click the mapping type hyperlink to open the Mapping Type Selection dialog.

  4. Select Mapped Superclass and then OK.

    Mapping Type Selection Dialog (Mapped Superclass)

    The Mapping Type Selection dialog with Mapped Superclass selected.
  5. Complete the remaining JPA Details view (for entities).


Related tasks

Adding persistence to a class
Specifying additional tables
Specifying entity inheritance