Mapped superclass |
An entities that extend a Mapped Superclass class inherit 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:
Abstract or concrete classes
A mapped superclass cannot be:
Be queried or passed as an argument to Entity-Manager or Query operations
Be the target of a persistent relationship
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:
Open the Java class in the Package Explorer.
Select the class in the JPA Structure view.
In the JPA Details view, use the Map As drop-list to select Mapped Superclass.
Complete the remaining JPA Details view (for entities).