TablePerHierarchy
TablePerHierarchy (TPH) is a strategy used in object-relational mapping (ORM) to map an inheritance hierarchy to a single database table. In TPH, all classes in the hierarchy are stored in a single table, with a discriminator column used to distinguish between different types of objects. This column typically contains values that indicate the specific subclass to which each row belongs.
TPH is particularly useful when dealing with a small number of subclasses, as it avoids the need
The main advantage of TPH is its simplicity and ease of use. It requires minimal configuration and
However, TPH also has some limitations. It can lead to a table with many columns, some of
In summary, TablePerHierarchy is a useful strategy for mapping an inheritance hierarchy to a single database