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 |
|
|
- 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:
- Define identifier mapping in the root class.
- Define attribute mappings or association mappings for each class.
- 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:
- 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.