鉴别器和内连接结合使用 内容和上两篇没有什么大的区别 Employee.hbm.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="domain"> <class name="Employee" discriminator-value="0"> <id name="id"> <generator class="native"/> </id> <discriminator column="type" type="int"/> <property name="name"></property> <many-to-one name="dpt" column="dpt_id" lazy="false"></many-to-one> <subclass name="Skiller" discriminator-value="1"> <property name="skill"></property> </subclass> <subclass name="Sales" discriminator-value="2"> <join table="sales"> <key column="employee_id"></key> <property name="sell"></property> </join> </joined-subclass> </class> </hibernate-mapping> 原理类似,只是标签上略有不同。