JPA defines several difference methods for persisting objects with inheritance. The @Inheritance
annotation is used in the root class to define SINGLE_TABLE, JOINED
, and TABLE_PER_CLASS
inheritance. For abstract classes that define common state or persistence behavior, but have no relationship on the database, the @MappedSuperclass
annotation can be used.
@Inheritance
@MappedSuperclass