日期:2014-05-18  浏览次数:20800 次

双向一对多添加时候未找到父项关键字
下面是剪辑过的异常信息。
12:27:20,964  WARN JDBCExceptionReporter:100 - SQL Error: 2291, SQLState: 23000
12:27:20,964 ERROR JDBCExceptionReporter:101 - ORA-02291: 违反完整约束条件 (CUPLRP.FKB76D97015CC32C4F) - 未找到父项关键字

12:27:20,964  WARN JDBCExceptionReporter:100 - SQL Error: 2291, SQLState: 23000
12:27:20,964 ERROR JDBCExceptionReporter:101 - ORA-02291: 违反完整约束条件 (CUPLRP.FKB76D97015CC32C4F) - 未找到父项关键字

12:27:20,964 ERROR AbstractFlushingEventListener:324 - Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
Caused by: java.sql.BatchUpdateException: ORA-02291: 违反完整约束条件 (CUPLRP.FKB76D97015CC32C4F) - 未找到父项关键字


配置文件:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="cn.xyurp.gygl.bean">
    <class name="DutyItem" table="t_apartment_dutyitem">
        <id name="id">
            <generator class="native" />
        </id>
        <property name="sTime" type="string" length="30"/>
        <property name="eTime" type="string" length="30"/>
    <property name="watchman" type="string" length="30"/>
    <property name="repContent" type="string" length="30"/>
        <property name="advice" type="string" length="30"/>
        <property name="flag" type="java.lang.String" length="1"/>
        <many-to-one name="dutyRecord" column="dutyRecordId" ></many-to-one>
        
    </class>
</hibernate-mapping>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="cn.xyurp.gygl.bean">
    <class name="DutyRecord" table="t_apartment_dutyrecord">
        <id name="id">
            <generator class="native" />
        </id>
        <pr