Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/367.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/hibernate/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java org.springframework.dao.OptimisticLockingFailureException与hibernate升级_Java_Hibernate_Spring Batch - Fatal编程技术网

Java org.springframework.dao.OptimisticLockingFailureException与hibernate升级

Java org.springframework.dao.OptimisticLockingFailureException与hibernate升级,java,hibernate,spring-batch,Java,Hibernate,Spring Batch,我已经将Hibernate升级到5.2.3,然后我将获得org.springframework.dao.OptimisticLockingFailureException和spring批处理作业 Spring的任务是从文件中读取数据,并创建流程图之类的东西,相关关系将存储在数据库中 升级之前,一切正常。这是什么原因 Spring批处理版本:3.0.10.发布 当我得到运行时异常(组件已经存在)时,就会发生这种情况,然后hibernate回滚事务,但spring批处理作业应该继续,但它抛出以下错误

我已经将Hibernate升级到
5.2.3
,然后我将获得
org.springframework.dao.OptimisticLockingFailureException
和spring批处理作业

Spring的任务是从文件中读取数据,并创建流程图之类的东西,相关关系将存储在数据库中

升级之前,一切正常。这是什么原因

Spring批处理版本:3.0.10.发布

当我得到运行时异常(组件已经存在)时,就会发生这种情况,然后hibernate回滚事务,但spring批处理作业应该继续,但它抛出以下错误

org.springframework.dao.OptimisticLockingFailureException: Attempt to update step execution id=0 with wrong version (1), where current version is 2
    at org.springframework.batch.core.repository.dao.JdbcStepExecutionDao.updateStepExecution(JdbcStepExecutionDao.java:257) ~[spring-batch-core-3.0.10.RELEASE.jar:3.0.10.RELEASE]
    at org.springframework.batch.core.repository.support.SimpleJobRepository.update(SimpleJobRepository.java:191) ~[spring-batch-core-3.0.10.RELEASE.jar:3.0.10.RELEASE]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_221]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_221]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_221]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_221]
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333) ~[spring-aop-4.3.23.RELEASE.jar:4.3.23.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) ~[spring-aop-4.3.23.RELEASE.jar:4.3.23.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.3.23.RELEASE.jar:4.3.23.RELEASE]
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) ~[spring-tx-4.3.23.RELEASE.jar:4.3.23.RELEASE]
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282) ~[spring-tx-4.3.23.RELEASE.jar:4.3.23.RELEASE]
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.3.23.RELEASE.jar:4.3.23.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.23.RELEASE.jar:4.3.23.RELEASE]
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) ~[spring-aop-4.3.23.RELEASE.jar:4.3.23.RELEASE]
    at com.sun.proxy.$Proxy207.update(Unknown Source) ~[?:?]
    at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:456) [spring-batch-core-3.0.10.RELEASE.jar:3.0.10.RELEASE]
    at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:330) [spring-batch-core-3.0.10.RELEASE.jar:3.0.10.RELEASE]
    at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) [spring-tx-4.3.23.RELEASE.jar:4.3.23.RELEASE]
    at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:272) [spring-batch-core-3.0.10.RELEASE.jar:3.0.10.RELEASE]
    at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:81) [spring-batch-core-3.0.10.RELEASE.jar:3.0.10.RELEASE]
    at org.springframework.batch.repeat.support.TaskExecutorRepeatTemplate$ExecutingRunnable.run(TaskExecutorRepeatTemplate.java:262) [spring-batch-infrastructure-3.0.10.RELEASE.jar:3.0.10.RELEASE]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_221]
14:52:18,095 ERROR [TaskletStep] JobRepository failure forcing rollback

我们必须设置此属性才能解决此问题

hibernate.allow\u update\u outside\u transaction=true

有关详细信息:

请参阅下面的链接以查看在发布过程中发生的更改

我们必须设置此属性才能解决此问题

hibernate.allow\u update\u outside\u transaction=true

有关详细信息:

请参阅下面的链接以查看在发布过程中发生的更改

您要从哪个版本的Hibernate升级?您是否也从以前的版本升级了Spring Batch,或者在问题之前和之后都是相同的3.0.10?您从哪个版本升级Hibernate?您是否也从以前的版本升级了Spring Batch,或者在发布之前和之后都是相同的3.0.10?