Java is an object-oriented programming language, and while working with the object-oriented paradigm, one thing comes to our mind: inheritance. We form a real-world scenario using IS A
and HAS A
relationships. Inheritance is supported by many languages, but relational databases are unable to understand the relationship of inheritance. Hibernate provides a way to map real-time relationships to the database.
Hibernate provides multiple strategies to achieve such a relationship for relational databases. There are three inheritance mapping strategies defined in hibernate:
Table per class hierarchy
Table per subclass
Table per concrete class