JPA provides the
@MappedSuperclass
annotation as a way of
factoring out common properties into a generic superclass to inherit
from. For example, you might decide that every entity should have a
LastUpdatedBy
property. You might then defined an
AbstractPersistentObject
superclass, with all
your entities inheriting from this. The
@MappedSuperclass
annotation indicates that this
superclass if for implementation inheritance (rather than type
inheritance), and therefore should not have any table defined for it.
Instead, the tables for every inheriting entity should have their own
columns (eg last_updated_by
); the inherited
properties are "pushed down" into the subclasses.
If necessary, inherited mapping information may be overridden in
the subclasses by using the @AttributeOverride
and @AssociationOverride
annotations.