3中
1.subclass
<class name="Worker" table="worker" discriminator-value="worker"> <id name="id" type="java.lang.Integer"> <column name="ID"/> <generator class="native"/> </id> <discriminator column="type" type="string"></discriminator> <property name="name"></property> <subclass name="Driver" discriminator-value="driver"> <property name="car"></property> </subclass> </class>
2.joined-subclass
<class name="Animal" table="animal"> <id name="id" type="java.lang.Integer"> <column name="ID"/> <generator class="native"/> </id> <property name="name"></property> <joined-subclass name="Cat" table="cat"> <key column="cat_id"></key> <property name="food"></property> </joined-subclass> </class>
3.union-subclass
<class name="Book" table="book"> <id name="id" type="java.lang.Integer"> <column name="ID"/> <generator class="assigned"/> </id> <property name="name"></property> <union-subclass name="English" table="english"> <property name="language"></property> </union-subclass> </class>