Create table t_bc_SaleTopX(
product_ID varchar2(40) Primary KEY references t_bc_product(product_ID), --产品ID
Sales number(10,2) , --销售量
UpdateTime  Date default sysdate --更新日期
);因为product_ID 又是主键又是外键  所以不知道如何映射 高手请指教

解决方案 »

  1.   

    Employee.hbm.xml中:
    <one-to-one name="person" class="Person"/>Person.hbm.xml中
    <class name="person" table="PERSON">
        <id name="id" column="PERSON_ID">
            <generator class="foreign">
                <param name="property">employee</param>
            </generator>
        </id>
        ...
        <one-to-one name="employee"
            class="Employee"
            constrained="true"/>
    </class>