<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
    <class name="com.zds.slms.domain.Merchandise" table="merchandise" >
        <id name="id" type="java.lang.Integer">
            <column name="id" />
            <generator class="identity" />
        </id>
        <property name="code" type="string">
            <column name="code" length="3" not-null="true">
                <comment>商品编号</comment>
            </column>
        </property>
        <property name="name" type="string">
            <column name="name" length="50" not-null="true">
                <comment>商品名称</comment>
            </column>
        </property>
        <property name="price" type="float">
            <column name="price" precision="5" scale="2" not-null="true" >
                <comment>单价</comment>
            </column>
        </property>
        <set name="stockins" table="stockin" inverse="true" lazy="true" fetch="select" cascade="all-delete-orphan">
            <key>
                <column name="merchandiseid" not-null="true">
                    <comment>进货单</comment>
                </column>
            </key>
            <one-to-many class="com.zds.slms.domain.Stockin" />
        </set>
        <set name="stockorders" table="stockorder" inverse="true" lazy="true" fetch="select" cascade="all-delete-orphan">
            <key>
                <column name="merchandiseid" not-null="true">
                    <comment>订货单</comment>
                </column>
            </key>
            <one-to-many class="com.zds.slms.domain.Stockorder" />
        </set>
    </class>
</hibernate-mapping>
