JPA Inheritence Overview
Inheritence is a key feature of object-oriented programming language in which a child class can acquire the properties of its parent class. This feature enhances reusability of the code.
The relational database doesn't support the mechanism of inheritance. So, Java Persistence API (JPA) is used to map the key features of inheritance in relational database model.
JPA Inheritence Annotations
Following are the most frequently used JPA inheritance annotations: -
Note - If we didn't pass the name of discriminator column and its value then JPA consider it by default. It considers DTYPE as discriminator column name and the name of the entity as discriminator value.
JPA Inheritence Strategies
JPA provides three strategies through which we can easily persist inheritance in database.