在实体的映射中获取重复列

时间:2016-07-01 05:02:02

标签: hibernate

实体映射中的重复列应使用insert =“false”update =“false”进行映射。如果我分别更改密钥和列标记,我没有收到此错误。如果我评论如下。我不知道这里发生了什么。

   <!-- <set name="children"    lazy="false" cascade="all" table="children"
   inverse="false">
     <key >
     < column="vendid" not-null="true"/>
    </key
    <one-to-many class="com.bidirect.Customer"/>
     </set> -->


<class name="com.bidirect.Vendor" table="vendor" >
    <id name="vendorid" column="vid">
  <generator class="native" /> 
    </id>
    <property name="vendorname" type="string">
        <column name="vname" length="10" not-null="true" />
    </property>
     <set name="children"    lazy="false" cascade="all" table="children"
   inverse="false">
     <key column="vendid" not-null="true"/>
    <one-to-many class="com.bidirect.Customer"/>
     </set>        
     </class>
   </hibernate-mapping>

 <hibernate-mapping>
   <class name="com.bidirect.Customer" table="customer" >
    <id name="customerid" column="vid">
  <generator class="native" /> 
    </id>
    <property name="customername" type="string">
        <column name="cname" length="10" not-null="true" />
    </property>

  <many-to-one name="parent" column="vendid" cascade="all" lazy="proxy"  
    class="com.bidirect.Vendor" not-null="true"></many-to-one>

  </class>
  </hibernate-mapping>

0 个答案:

没有答案