-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Java Hibernate Cookbook
By :
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
In this recipe, we will take a look at table per class hierarchy.
Here, we will create a new data structure that will help you understand the inheritance strategy.
Consider a class, Employee. We will extend the Employee class into two subclasses—PermanentEmployee and ContractualEmployee...
Change the font size
Change margin width
Change background colour