开发者社区> 我是温浩然> 正文
阿里云
为了无法计算的价值
打开APP
阿里云APP内打开

违反完整约束条件 (EDITORIAL_REAL.FK34BFDAE1DBFDB44D) - 未找到父项关键字

简介: 今天在改代码的时候,发现报错如下: Hibernate: insert into M_CUS_MARKETING_RELATIONSHIP (CRM_CORP_TYPE_ID, M_ID, M_CUSM_ID) values (?, ?, ?) 四月 13, 2016 2:52:33 下午 org.hiber
+关注继续查看

今天在改代码的时候,发现报错如下:

Hibernate: 
    insert 
    into
        M_CUS_MARKETING_RELATIONSHIP
        (CRM_CORP_TYPE_ID, M_ID, M_CUSM_ID) 
    values
        (?, ?, ?)
四月 13, 2016 2:52:33 下午 org.hibernate.util.JDBCExceptionReporter logExceptions
警告: SQL Error: 2291, SQLState: 23000
四月 13, 2016 2:52:33 下午 org.hibernate.util.JDBCExceptionReporter logExceptions
严重: ORA-02291: 违反完整约束条件 (EDITORIAL_REAL.FK34BFDAE1DBFDB44D) - 未找到父项关键字

四月 13, 2016 2:52:33 下午 org.hibernate.util.JDBCExceptionReporter logExceptions
警告: SQL Error: 2291, SQLState: 23000
四月 13, 2016 2:52:33 下午 org.hibernate.util.JDBCExceptionReporter logExceptions
严重: ORA-02291: 违反完整约束条件 (EDITORIAL_REAL.FK34BFDAE1DBFDB44D) - 未找到父项关键字

org.springframework.dao.DataIntegrityViolationException: Could not execute JDBC batch update; SQL [insert into M_CUS_MARKETING_RELATIONSHIP (CRM_CORP_TYPE_ID, M_ID, M_CUSM_ID) values (?, ?, ?)]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
	at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:643)
	at org.springframework.orm.hibernate3.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:793)
	at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:664)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
	at com.sun.proxy.$Proxy339.saveAll(Unknown Source)
	at cn.digitalpublishing.springmvc.controller.marketing.MCusMarketingRelationshipController.batchSave(MCusMarketingRelationshipController.java:61)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
	at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436)
	at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at cn.digitalpublishing.filter.LanguageFilter.doFilter(LanguageFilter.java:30)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at cn.com.daxtech.framework.web.filter.sso.PermissionFilter.doFilter(PermissionFilter.java:162)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:96)
	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:268)
	at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:184)
	at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
	at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
	at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
	at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:383)
	at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:133)
	at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:656)
	... 51 more
Caused by: java.sql.BatchUpdateException: ORA-02291: 违反完整约束条件 (EDITORIAL_REAL.FK34BFDAE1DBFDB44D) - 未找到父项关键字

	at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10500)
	at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:230)
	at sun.reflect.GeneratedMethodAccessor442.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.logicalcobwebs.proxool.ProxyStatement.invoke(ProxyStatement.java:68)
	at org.logicalcobwebs.cglib.proxy.Proxy$ProxyImpl$$EnhancerByCGLIB$$49938ac2.executeBatch(<generated>)
	at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
	at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
	... 59 more
根据错误日志分析,

肯定是在执行插入语句时报错.

M_CUS_MARKETING_RELATIONSHIP
而且,应该是与外键有关.

到sql中,去查看该表的外键关系.

发现多出来两个没有用的外键关联.

删掉就可以了.

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

相关文章
different way to retrieve SAP UI5 manifest
Created by Wang, Jerry, last modified on Jun 06, 2016
0 0
享读SpringMVC源码2-@RequestMapping注解源码(上)
享读SpringMVC源码2-@RequestMapping注解源码(上)
0 0
享读SpringMVC源码2-@RequestMapping注解源码(下)
享读SpringMVC源码2-@RequestMapping注解源码(下)
0 0
C/C++关键字之restrict
C/C++关键字之restrict
0 0
SAP ABAP COMMIT WORK 关键字的一些使用要点
ABAP 语句 COMMIT WORK 提交在 SAP LUW 期间完成的更改。它不能与 DB-Commit 混淆。
0 0
《A Perfect Solution for Live Migration with Pass-through Devices》电子版地址
A Perfect Solution for Live Migration with Pass-through Devices
0 0
+关注
我是温浩然
今天的菜鸟,未来的大牛
文章
问答
文章排行榜
最热
最新
相关电子书
更多
低代码开发师(初级)实战教程
立即下载
阿里巴巴DevOps 最佳实践手册
立即下载
冬季实战营第三期:MySQL数据库进阶实战
立即下载