<?
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
>
<
class
name
="Tuser"
table
="T_User"
>
<
id
name
="id"
column
="id"
type
="java.lang.Integer"
>
<
generator
class
="native"
/>
</
id
>
<
property
name
="name"
column
="name"
type
="java.lang.String"
/>
<!--
<property name="age" column="age" type="java.lang.Integer"/>
-->
<!--
<property name="email" column="email" type="EMailList"/>
-->
<!--
<property name="image" column="image" type="java.sql.Blob"/>
-->
<
property
name
="resume"
column
="resume"
type
="clob"
/>
</
class
>
</
hibernate-mapping
>
復合主鍵
<?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>
<class name="TUser2" table="T_User2">
<composite-id name="userPk" class="TUserPk">
<key-property name="firstName" column="firstname" type="java.lang.String"/>
<key-property name="lastName" column="lastname" type="java.lang.String"/>
</composite-id>
<property name="age" column="age" type="java.lang.Integer"/>
</class>
</hibernate-mapping>
DISCRIMINATOR
<?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>
<class name="TItem" table="T_Item">
<id name="id" column="id">
<generator class="native"/>
</id>
<discriminator column="category" type="java.lang.String"/>
<property name="manufacturer" column="manufacturer"/>
<property name="name" column="name"/>
<subclass name="TBook" discriminator-value="1">
<property name="pageCount" column="pagecount"/>
</subclass>
<subclass name="TDVD" discriminator-value="2">
<property name="regionCode" column="regionCode"/>
</subclass>
</class>
</hibernate-mapping>