在JpaPagingItemReader中使用spring批处理的tasklet时批处理运行出错

在JpaPagingItemReader中使用springlet的实体管理器中的tasklet运行批处理作业时,我们面临以下错误

有人可以帮忙吗...

2016-04-08 15:04:04,441 CASTXN-545651522545055错误[SimpleAsyncTaskExecutor-1] osbcsAbstractStep [AbstractStep.java:222]遇到执行步骤javax.persistence.TransactionRequiredException的错误:org.hibernate中没有正在进行的事务org.hibernate.jpa.spi.AbstractEntityManagerImpl.flush中的.jpa.spi.AbstractEntityManagerImpl.checkTransactionNeeded(AbstractEntityManagerImpl.java:1171)〜[hibernate-entitymanager-4.3.6.Final.jar:4.3.6.Final](AbstractEntityManagerImpl . java:1332)〜[hibernate-entitymanager-4.3.6.Final.jar:4.3.6.Final] at sun.reflect.GeneratedMethodAccessor362.invoke(Unknown Source)〜[na:na] at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:55)〜[na:1.7.0]在org.springframework的java.lang.reflect.Method.invoke(Method.java:618)〜[na:2.6(01-06-2014)] . orm.jpa.ExtendedEntityManagerCreator $ ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:334)~ [spring-orm-4.0.2.RELEASE.jar:4.0.2.RELEA SE] at com.sun.proxy . $ Proxy172.flush(Unknown Source)〜[na:na] at sun.reflect.GeneratedMethodAccessor362.invoke(Unknown Source)〜[na:na] at sun.reflect.DelegatingMethodAccessorImpl.invoke(在org.springframework.orm的java.lang.reflect.Method.invoke(Method.java:618)〜[na:2.6(01-06-2014)]中委托MethodAethodAccessorImpl.java:55)〜[na:1.7.0] .jpa.SharedEntityManagerCreator $ SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:257)〜[spring-orm-4.0.2.RELEASE.jar:4.0.2.RELEASE] at com.sun.proxy . $ Proxy172.flush(Unknown Source) 〜[na:na]在org.springframework的com.nucleus.collection.framework.processes.tasklet.CaseStampingTasklet.execute(CaseStampingTasklet.java:147)〜[collection-framework-1.0.0-SNAPSHOT.jar:na] . batch.core.step.tasklet.TaskletStep $ ChunkTransactionCallback.doInTransaction(TaskletStep.java:386)〜[spring-batch-core-2.1.9.RELEASE.jar:na] at org.springframework.transaction.support.TransactionTemplate.execute (TransactionTemplate.java:133)〜[spring-tx-4.0.2.RELE ASE.jar:4.0.2.RELEASE]在org.springframework.batch.core.step.tasklet.TaskletStep $ 2.doInChunkContext(TaskletStep.java:264)〜[spring-batch-core-2.1.9.RELEASE.jar: na] at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:76)〜[spring-batch-core-2.1.9.RELEASE.jar:na] org.springframework.batch . 在org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java)的repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:367)〜[spring-batch-infrastructure-2.1.9.RELEASE.jar:na] :214)〜[spring-batch-infrastructure-2.1.9.RELEASE.jar:na] org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:143)

回答(0)