When this ing is used, the parent class instance is stored in the parent class table, while the Child class instance is stored in the parent class table and the Child class table. Because the subclass instance is also a special parent class instance, it must also contain the attributes of the parent class instance.Store the attributes that are common to the Child class and the parent class in the parent class table, and the attributes added to the Child class are saved in the Child class table.
In this ing policy, the classifier column is not required, but the <key... /> element ing has a primary key ------ this primary key column will also refer to the primary key column of the parent table.
Person. HBM. xml:
<? XML version = "1.0"?> <! Doctype hibernate-mapping public "-// hibernate/hibernate DTD ing DTD 3.0 // en" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
Run personmanager. Java to view the database:
When you need to query a record with ID 5, Hibernate will query the data with ID 5 from the persons table and query the records with ID 5 in the customer table. Concatenates two records into one instance. Of course, this concatenation is done through a join SQL statement ------ this is also the reason why this ing policy is called joined-subclass.
UseJoined-subclassInherits the ing policy whenProgramWhen querying subclass instances, You need to query across multiple tables. The number of tables to be crossed depends on the number of parent classes in the subclass ------ this is because the data of the subclass is stored in multiple parent tables in sequence. Because of this policy,Therefore, the inheritance ing policy of joined-subclass has a certain impact on query performance.