组件映射

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
    <class name="com.dys.model.User" table="USERS" schema="SCOTT">
        <id name="id" type="java.lang.Long">
            <column name="ID" length="8"/>
            <generator class="sequence">
                <param name="sequence">GUESTBOOK_SEQ</param>
            </generator>
        </id>
        <property name="username" type="java.lang.String">
            <column name="USERNAME" length="20"/>
        </property>
        <property name="password" type="java.lang.String">
            <column name="PASSWORD" length="20"/>
        </property>
        <component name="profile" class="com.dys.model.Profile">
            <property name="email" type="java.lang.String">
                <column name="EMAIL" length="20"/>
            </property>
            <property name="phone" type="java.lang.String">
                <column name="PHONE" length="20"/>
            </property>
            <property name="mobile" type="java.lang.String">
                <column name="MOBILE" length="20"/>
            </property>
            <property name="address" type="java.lang.String">
                <column name="ADDRESS" length="20"/>
            </property>
            <property name="postCode" type="java.lang.String">
                <column name="POSTCODE" length="20"/>
            </property>
        </component>
    </class>
</hibernate-mapping>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
    <class name="com.dys.model.User" table="USERS" schema="SCOTT">
        <id name="id" type="java.lang.Long">
            <column name="ID" length="8"/>
            <generator class="sequence">
                <param name="sequence">GUESTBOOK_SEQ</param>
            </generator>
        </id>
        <property name="username" type="java.lang.String">
            <column name="USERNAME" length="20"/>
        </property>
        <property name="password" type="java.lang.String">
            <column name="PASSWORD" length="20"/>
        </property>
        <component name="profile" class="com.dys.model.Profile" lazy="true">
            <parent name="user"/>
            <property name="email" type="java.lang.String">
                <column name="EMAIL" length="20"/>
            </property>
            <property name="phone" type="java.lang.String">
                <column name="PHONE" length="20"/>
            </property>
            <property name="mobile" type="java.lang.String">
                <column name="MOBILE" length="20"/>
            </property>
            <property name="address" type="java.lang.String">
                <column name="ADDRESS" length="20"/>
            </property>
            <property name="postCode" type="java.lang.String">
                <column name="POSTCODE" length="20"/>
            </property>
        </component>
    </class>
</hibernate-mapping>

 

你可能感兴趣的:(组件)