第一种方法
Person.hbm.xml
<class name="Person">
<id name="oid" column="person_oid" type="long">
<generator class="hilo"/>
</id>
...
<union-subclass name="guest" table="guest_tab" >
<property name="..."/>
...
</union-subclass>
<union-subclass name="admin" table="admin_tab" >
<property name="..."/>
...
</union-subclass>
</class>
第二种方法
user.hbm.xml
<class name="User" table="user_tab" discriminator-value="USER">
<id name="userId" type="int" column="userId">
<generator class="native"></generator>
</id>
<discriminator column="TYPE" type="string"></discriminator>
<subclass name="Guest" discriminator-value="Guest"></subclass>
<subclass name="Admin" discriminator-value="Admin"></subclass>
</class>