java(bug)-java.sql.BatchUpdateException: ORA-02291: 违反完整约束条件 (WBS_HB3.FK712574B3C998E31B) - 未找到父项关键字

1.查询数据库

提示: ORA-02291: 违反完整约束条件 (WBS_HB3.FK712574B3C998E31B);

select * from user_cons_columns cl where cl.constraint_name = 'FK712574B3C998E31B'   --查询跟哪个表的哪个字段关联

2.打开log的日志记录(SQL 和 类型参数)

log4j.logger.org.hibernate.SQL=trace   

log4j.logger.org.hibernate.type=trace

3.将日志中打印的 SQL 和 参数值整合到一起,查看(第一步查询出的)报错的字段。

Hibernate: 
   insert 
    into
        s_audit_entry
        (client_ip, requested_datetime, requested_url, user_account, user_id, user_name, audit_type, category_code, category_name, class_name, duration, exception, method_name, oper_data, oper_name, succeed_flag, id) 
    values
        (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)  //一共17个'?',对应下列的值。
2018-06-26 16:29:19 DEBUG StringType:133 - binding '127.0.0.1' to parameter: 1
2018-06-26 16:29:19 DEBUG TimestampType:133 - binding '2018-06-26 16:29:19' to parameter: 2
2018-06-26 16:29:19 DEBUG StringType:133 - binding 'http://127.0.0.1:8081/epms_hb/demandAction.do' to parameter: 3
2018-06-26 16:29:19 DEBUG StringType:133 - binding 'admin' to parameter: 4
2018-06-26 16:29:19 DEBUG StringType:133 - binding '1' to parameter: 5
2018-06-26 16:29:19 DEBUG StringType:133 - binding 'admin' to parameter: 6
2018-06-26 16:29:19 DEBUG StringType:133 - binding 'StrutsAction' to parameter: 7
2018-06-26 16:29:19 DEBUG StringType:133 - binding 'com.boco.wbs.c.action.wbs.demand' to parameter: 8
2018-06-26 16:29:19 DEBUG StringType:133 - binding 'com.boco.wbs.c.action.wbs.demand' to parameter: 9
2018-06-26 16:29:19 DEBUG StringType:133 - binding 'com.boco.wbs.c.action.wbs.demand.DemandAction' to parameter: 10
2018-06-26 16:29:19 DEBUG LongType:133 - binding '97' to parameter: 11
2018-06-26 16:29:19 DEBUG StringType:133 - binding 'findListPage' to parameter: 13
2018-06-26 16:29:19 DEBUG StringType:133 - binding 'findListPage' to parameter: 15
2018-06-26 16:29:19 DEBUG BooleanType:133 - binding 'true' to parameter: 16
2018-06-26 16:29:19 DEBUG LongType:133 - binding '67916180' to parameter: 17

4.完善SQL后直接在数据库内执行,查看结果。



你可能感兴趣的:(bug--java)