Hibernate Inheritance Mapping

Hibernate provides following ways to implement IS-A relation between entities.They are as follows.

  • Table Per Hierarchy
  • Table Per Subclass
  • Table Per Concrete Class

Table Per Hierarchy

In Table Per Hierarchy mapping, single table is required to map the whole hierarchy.An extra column called discriminator is added to table to identify the class.

Table Per Subclass

In Table Per Subclass mapping,we need table for each classes.Their primary key-foreign key relation between tables.

Table Per Concrete Class

In Table Per Concrete Class mapping, we need tables for each class and there’s no relation between tables.So many of ORM frameworks don’t support this mapping,Hibernate does support this mapping.

Leave a Reply