Code:
<class name="cn.mBig.experience.vo.SuffererVO" table="EXM_SUFFERER">
<id name="id" type="java.lang.Long" unsaved-value="0">
<column name="ID" sql-type="INT(10)"/>
<generator class="identity"/>
</id>
<property name="name">
<column name="NAME" not-null="true" sql-type="VARCHAR(40)"/>
</property>
<property name="creationDate" type="timestamp" column="CREATIONDATE"/>
<property name="description">
<column name="DESCRIPTION" sql-type="VARCHAR(255)"/>
</property>
<many-to-one name="creationUser" class="cn.mBig.experience.vo.UserVO" cascade="none" insert="false" update="false">
<column name="CREATION_USER_ID" sql-type="INT(10)"/>
</many-to-one>
<property type="java.lang.Long" name="creationUid">
<column name="CREATION_USER_ID" sql-type="INT(10)"/>
</property>
<property type="java.lang.Byte" name="state">
<column name="STATE" sql-type="TINYINT(1)"/>
</property>
<property type="java.lang.Byte" name="gender">
<column name="GENDER" sql-type="TINYINT(1)"/>
</property>
<many-to-one name="application" class="cn.mBig.experience.vo.ApplicationVO" cascade="none" insert="false" update="false">
<column name="APPLICATION_ID" sql-type="INT(10)"/>
</many-to-one>
<property type="java.lang.Long" name="applicationId">
<column name="APPLICATION_ID" sql-type="INT(10)"/>
</property>
<property name="address">
<column name="ADDRESS" sql-type="VARCHAR(50)"/>
</property>
<property name="idCard">
<column name="ID_CARD" sql-type="VARCHAR(30)"/>
</property>
<property name="phone">
<column name="PHONE" sql-type="VARCHAR(40)"/>
</property>
<property name="birthday" type="date" column="BIRTHDAY"/>
<bag name="suits" lazy="true" table="EXM_SUFFERER_SUIT" cascade="save-update">
<key>
<column name="SUFFERER_ID" sql-type="INT(10)"/>
</key>
<many-to-many class="cn.mBig.experience.vo.SuitVO">
<column name="SUIT_ID" sql-type="INT(10)"/>
</many-to-many>
</bag>
<bag name="units" lazy="true" table="EXM_SUFFERER_UNIT" cascade="save-update">
<key>
<column name="SUFFERER_ID" sql-type="INT(10)"/>
</key>
<many-to-many class="cn.mBig.experience.vo.UnitVO">
<column name="UNIT_ID" sql-type="INT(10)"/>
</many-to-many>
</bag>
<bag name="Results" lazy="false" cascade="all">
<key>
<column name="SUFFERER_ID"/>
</key>
<one-to-many class="cn.mBig.experience.vo.result.InspectResultVO"/>
</bag>
</class>
Code:
<class name="cn.mBig.experience.vo.result.InspectResultVO" table="EXM_INSPECT_RESULT">
<composite-id>
<key-property name="suffererId" type="java.lang.Long">
<column name="SUFFERER_ID" not-null="true" sql-type="INT(10)"/>
</key-property>
<key-property name="itemId" type="java.lang.Long">
<column name="ITEM_ID" not-null="true" sql-type="INT(10)"/>
</key-property>
</composite-id>
<property name="result" type="java.lang.String">
<column name="RESULT" not-null="true" sql-type="VARCHAR(255)"/>
</property>
</class>
when i delete SuffererVO, i thought hibernate might run "delete from EXM_INSPECT_RESULT where SUFFERER_ID=?"
but hibernate out print sql:
Hibernate: delete from EXM_SUFFERER_SUIT where SUFFERER_ID=?
Hibernate: delete from EXM_SUFFERER_UNIT where SUFFERER_ID=?
Hibernate: update EXM_INSPECT_RESULT set SUFFERER_ID=null where SUFFERER_ID=?
2003-10-10 13:06:02 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
warning: SQL Error: 1062, SQLState: S1009
2003-10-10 13:06:02 net.sf.hibernate.util.JDBCExceptionReporter logExceptions
fatal: Invalid argument value, message from server: "Duplicate entry '0-1' for key 1"
2003-10-10 13:06:02 net.sf.hibernate.JDBCException <init>
fatal: Could not synchronize database state with session
java.sql.BatchUpdateException: Invalid argument value, message from server: "Duplicate entry '0-1' for key 1"
why?
how to get my wish operat?