Hibernate 多对一映射

<?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.Product" table="PRODUCT" 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="name" type="java.lang.String">
            <column name="NAME" length="20"/>
        </property>
        <property name="price" type="java.lang.Double">
            <column name="PRICE" precision="6" scale="2"/>
        </property>
        <property name="description" type="java.lang.String">
            <column name="DESCRIPTION" length="20"/>
        </property>
        <many-to-one name="catagory" class="com.dys.model.Catagory" outer-join="true">
            <column name="CATAGORY_ID" precision="8" scale="0"/>
        </many-to-one>
    </class>
</hibernate-mapping>

 

你可能感兴趣的:(Hibernate)