There are three types of inheritance mappings for hibernate: subclass, joined-subclass, and union-subclass.
These three methods have their own capabilities and can play an ineffective role in situations where they cannot.
1. subclass: a large table
Discriminator)
Discriminator-value= "Employee">
Discriminator-value= "Manager">
Discriminator-value= "Customer">
All fields are in a large table and can be used for statistical analysis.
2. joined-subclass parent-child table
To use this policy, you must use The element maps the primary keys of the Parent and Child classes, Data columns mapped to elements are both primary key columns and foreign key columns.
<
KeyColumn = "employee_id"/>
<
KeyColumn = "customer_id"/>
A large table cannot be infinitely large. To a certain extent, a word table must be produced.
3. union-subclass classification function table
Table sharding by column enables each table to be oriented to one category, that is, it can be used independently or linked together to form a large table.
Summary:
Second in life, second in life, fourth in life, and four in Vientiane. The top-level tables are suitable for global statistics and are not suitable for presentation. The bottom-level tables are suitable for presentation of various representations, however, it is difficult to control the overall situation.