标题:Could not execute JDBC batch update异常如何解决啊
只看楼主
亮剑
Rank: 1
等 级:新手上路
帖 子:148
专家分:0
注 册:2006-10-18
 问题点数:0 回复次数:3 
Could not execute JDBC batch update异常如何解决啊

我在删除订单的时候抛了个异常!(SQL语句已经输出了)

org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:249)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:144)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at cn.com.ecport.datavisit.test.OrderTest.tearDown(OrderTest.java:25)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.sql.BatchUpdateException: Cannot delete or update a parent row: a foreign key constraint fails (`ecport/userinfo`, CONSTRAINT `userinfo_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`))
at com.mysql.jdbc.ServerPreparedStatement.executeBatch(ServerPreparedStatement.java:665)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242)
... 19 more

搜索更多相关主题的帖子: batch update Could JDBC execute 
2007-04-08 12:39
千里冰封
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:灌水之王
等 级:版主
威 望:155
帖 子:28477
专家分:59
注 册:2006-2-26
得分:0 
不能执行JDBC批处理更新

原因是外键约束失败

可惜不是你,陪我到最后
2007-04-08 13:53
亮剑
Rank: 1
等 级:新手上路
帖 子:148
专家分:0
注 册:2006-10-18
得分:0 
是配制文件的问题吗
如何来解决呢
2007-04-08 18:30
支离破碎
Rank: 6Rank: 6
等 级:贵宾
威 望:23
帖 子:737
专家分:0
注 册:2007-1-4
得分:0 
是你数据库的设计问题或是你更新方式不对

人生漂泊無依,有如浮萍菱花,隨水飄流,你会在我这里停留吗?
[url=http://51mynet.]http://51mynet.[/url]
2007-04-09 09:43



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-130113-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.438474 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved