Inheritance: Table Per Concrete Class Hierarchy

Table Per Concrete class Hierarchy :

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


In case of Table Per Concrete class, there will be changes in the mapping file.
In this we would require table for child classes, but not for the parent class

In table per concrete class hierarchy, number of subclasses is equals to number of tables required(example two sub-class required two tables).

x number of derived classes = x number of tables in the database

One new element <union-subclass — >under <class —> will be introduced in the mapping file.


This is the easiest method of Inheritance mapping to implement.


  • Data that belongs to a parent class is scattered across a number of subclass tables, which represents concrete classes.
  • Changes to a parent class is reflected to large number of tables.

Lets see an example :

Required files_

  • (Base class)
  • (Derived class)
  • (Derived class)
  • (Persistence  logic)
  • Payment.hbm.xml
  • hibernate.cfg.xml




Comments are closed