In this strategy, each class is mapped to its own primary table. Primary tables of child classes have reference keys referring to the primary tables of the parent classes.
An Inheritance annotation with JOINED strategy is generated. The PrimaryKeyJoinColumn annotation is generated to define a join column that joins the primary table of an Entity subclass to the primary table of its superclass.
For more informations about mapping, see Object/Relational (O/R) Mapping.
@Entity(name="Shape") @Inheritance(strategy=InheritanceType.JOINED) @DiscriminatorColumn(name="shapeType") @Table(name="Shape") public class Shape { ... } @Entity(name="Rectangle") @Inheritance(strategy=InheritanceType.JOINED) @PrimaryKeyJoinColumns({ @PrimaryKeyJoinColumn(name="sid", referencedColumnName="sid") }) @Table(name="Rectangle") public class Rectangle extends Shape { ... }
A model check is available to verify that primary tables of child classes have reference keys referring to the primary tables of their parent classes.