In the previous recipe, we went through the table per class hierarchy inheritance strategy. Table per class hierarchy stores all the rows in a single table and the discriminator column is used to uniquely identify the records. Sometimes, the tables become very large if the hierarchy is deep. In such a case, we can use another strategy called table per subclass.
In the table-per-subclass strategy, hibernate creates separate tables for each class. The relationship exists between the parent and child tables, where the common data is stored in the parent class and the data of the subclass is stored in a separate specific table.
Consider a new table structure as shown in the following table:
