Table Per Class Hierarchy Inheritance Mapping Strategy

The whole class hierarchy is mapped to one table. One character based type or integer type discriminator column is defined to distinguish instances of difference classes in the hierarchy.

Classes Tables




  1. Define class mappings for each class in the hierarchy so that all the classes have the same primary table. They can also be mapped to other secondary tables:


  2. Define identifier mapping in the root class.
  3. Define attribute mappings or association mappings for each class.
  4. Select one of the attributes in the root class, as the Specifying Attribute in the property sheet of one of the children inheritance links of the root class to specify it as a discriminator column, which is used to distinguish between different class instances. In the following example, we define one extra attribute shapeType in Shape and select it as discriminator attribute:


  5. Define persistence generation type for each class. Define the persistence generation type of the root class as Generate table and all the other classes as Migrate columns.