Advertisement



< Prev
Next >



Hibernate Mapping Table Per Class Inheritance



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

As the name says, table per class strategy allows us to performing inheritance using Hibernate that will create different tables created for each class involved in the inheritance. i.e. a separate table for parent class and a separate table for each of its child classes, with each child class inheriting the properties from the parent class.

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 table per class strategy.




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

PYTHON and DJANGO


Advertisement