< Prev
Next >

Hibernate Mapping Joined Inheritance

In our last article, we performed mapped inheritance between the classes to database using joined strategy with Hibernate annotations. In this article, we are going to show you how to perform inheritance using Hibernate's joined strategy by using mapping resource file, instead of using annotations.

Using the joined strategy will create a separate table for parent class and a separate table for each of its child classes and the child classes will remain with the specific properties mentioned in them while the inherited properties of parent class are going to remain with the parent class only, except the primary key of the parent class which will become a foreign key in the child classes.

Let's take the same example of an Entity class - Country, which is extended/inherited by two classes AsianCountry and EurpoeanCountry. Now, let's see how Hibernate performs object-relational-mapping(ORM) to represent the inheritance between these three classes in the database, by using joined strategy.

Note :

Please Subscribe

Please subscribe to our social media channels for daily updates.

Decodejava Facebook Page  DecodeJava Twitter Page Decodejava Google+ Page



Please check our latest addition