实体映射中的重复列应使用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>