Hibernate inheritance

Hibernate Inheritance strategy: Table Per Class Hierarchy

I am going to give explaination and example on hibernate table per class hierarchy, consider we have base class named Person and two derived classes – Student and Teacher If we save the derived class object like Student or Teacher then automatically Person class object will also be saved into the database, and in the […]

Hibernate Inheritance strategy: Table Per SubClass Hierarchy

In Table Per SubClass Hierarchy there will be the number of classes equals to the number of tables in the database. If we save the Student class object, hibernate will first save the data related to super class object into the super class related table in the database and then Student object data in Student […]

Hibernate Inheritance strategy: Table Per Concrete Class Hierarchy

In Table Per Concrete Class Hierarchy will have the number of tables in the database equals to the number of derived classes. Once we save the derived class object, then derived class data and base class data will be saved in the derived class related table in the database. We need the tables only for […]

Scroll to top