Advertisement



< Prev
Next >



Hibernate Mapping Single Table Inheritance



Today we are going to understand how to map inheritance between the classes to the database with Hibernate using the mapping resource xml file(without using Annotation). As you already know, inheritance is used when a class wants to use/inherit the features of another existing class.

The class that wants to use the feature of another class, is called subclass, whereas the class whose features are to be used/inherited is referred to as superclass. A class inheriting from another class, can access its features and can also add its own specific features.

Let's take an example of an Entity class - Country, which is extended by two classes AsianCountry and EurpoeanCountry. By default, Hibernate performs the inheritance between classes by combining all of their objects under single table and this strategy is also called Single Table Strategy. Now, let's see how Hibernate performs object-relational-mapping(ORM) to represent the inheritance between these three classes in the database.




Note :


Please Subscribe

Please subscribe to our social media channels for daily updates.


Decodejava Facebook Page  DecodeJava Twitter Page Decodejava Google+ Page




Advertisement



Notifications



Please check our latest addition

C#, PYTHON and DJANGO


Advertisement