问题描述
我在保存时出现了此错误,异常代码:Hibernate:insertintoSTATICS.MatchUserList(SALES,LASTSALES,TRANSFOR_RATE,BACK_RATE,GROWTH_RATE,TRADEGROWTHRATE,ORDERS,VISITORS,LEVEL,SCORE,VIEWS,TRADES,BUYERNUMS,TOTALBUYERNUMS,U_ID)values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)WARN[main]org.hibernate.util.JDBCExceptionReporter.logExceptions(77)|SQLError:-4228,SQLState:nullERROR[main]org.hibernate.util.JDBCExceptionReporter.logExceptions(78)|[jcc][t4][102][10040][3.57.82]非原子批处理出现故障。虽然已经提交了批处理,但是该批处理的某个成员至少发生了一个异常。使用getNextException()来检索已经过批处理的特定元素的异常。ERRORCODE=-4228,SQLSTATE=nullWARN[main]org.hibernate.util.JDBCExceptionReporter.logExceptions(77)|SQLError:-407,SQLState:23502ERROR[main]org.hibernate.util.JDBCExceptionReporter.logExceptions(78)|Errorforbatchelement#1:DB2SQLError:SQLCODE=-407,SQLSTATE=23502,SQLERRMC=TBSPACEID=2,TABLEID=268,COLNO=3,DRIVER=3.57.82ERROR[main]org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(301)|Couldnotsynchronizedatabasestatewithsessionorg.hibernate.exception.ConstraintViolationException:CouldnotexecuteJDBCbatchupdateatorg.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)atorg.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)atorg.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)atorg.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:237)atorg.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)atorg.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)atorg.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)atorg.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)atorg.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)atorg.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)atorg.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:655)atorg.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:732)atorg.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:701)atorg.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:321)atorg.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116)atorg.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)atorg.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)atcn.firstbillion.match.service.MatchUserListServiceImpl$$EnhancerByCGLIB$$1562535c.saveMatchUserListByMatchuser(<generated>)atcn.firstbillion.match.test.testMatchUserListService.testAddMatchUser(testMatchUserListService.java:16)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)atjava.lang.reflect.Method.invoke(Method.java:592)atjunit.framework.TestCase.runTest(TestCase.java:154)atjunit.framework.TestCase.runBare(TestCase.java:127)atjunit.framework.TestResult$1.protect(TestResult.java:106)atjunit.framework.TestResult.runProtected(TestResult.java:124)atjunit.framework.TestResult.run(TestResult.java:109)atjunit.framework.TestCase.run(TestCase.java:118)atjunit.framework.TestSuite.runTest(TestSuite.java:208)atjunit.framework.TestSuite.run(TestSuite.java:203)atorg.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)atorg.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)atorg.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)atorg.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)atorg.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)atorg.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)Causedby:com.ibm.db2.jcc.am.wn:[jcc][t4][102][10040][3.57.82]非原子批处理出现故障。虽然已经提交了批处理,但是该批处理的某个成员至少发生了一个异常。使用getNextException()来检索已经过批处理的特定元素的异常。ERRORCODE=-4228,SQLSTATE=nullatcom.ibm.db2.jcc.am.bd.a(bd.java:404)atcom.ibm.db2.jcc.am.p.a(p.java:353)atcom.ibm.db2.jcc.am.lm.a(lm.java:3998)atcom.ibm.db2.jcc.am.lm.c(lm.java:3785)atcom.ibm.db2.jcc.am.lm.executeBatch(lm.java:2257)atorg.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)atorg.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)atorg.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:246)...34more求救高手!帮帮忙。
解决方案
解决方案二:
在出错的语句上加个断点看看,肯定是“values”中的某个值有问题!