private Logger logger = LoggerFactory.getLogger(getClass()); @PersistenceContext(unitName="default") protected EntityManager em; @Override public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { // TODO Auto-generated method stub long startTime=System.currentTimeMillis(); String sqlString = "CALL PROCEDURE11"; Query query = em.createNativeQuery(sqlString.toString()); query.executeUpdate(); logger.info("耗时:" + (System.currentTimeMillis()-startTime)/1000 + "s"); return null; }
代码。
报错信息:
Hibernate: CALL PROCEDURE11 WARN 27-02 15:31:45,033 - SQL Error: -440, SQLState: 42884 ERROR 27-02 15:31:45,034 - DB2 SQL Error: SQLCODE=-440, SQLSTATE=42884, SQLERRMC=PROCEDURE11;PROCEDURE, DRIVER=3.59.81 WARN 27-02 15:31:45,034 - SQL Error: -727, SQLState: 56098 ERROR 27-02 15:31:45,034 - DB2 SQL Error: SQLCODE=-727, SQLSTATE=56098, SQLERRMC=2;-440;42884;PROCEDURE11|PROCEDURE, DRIVER=3.59.81 WARN 27-02 15:31:45,034 - SQL Error: -727, SQLState: 56098 ERROR 27-02 15:31:45,034 - DB2 SQL Error: SQLCODE=-727, SQLSTATE=56098, SQLERRMC=2;-440;42884;PROCEDURE11|PROCEDURE, DRIVER=3.59.81 ERROR 27-02 15:31:45,037 - Encountered an error executing the step org.springframework.orm.jpa.JpaSystemException: org.hibernate.exception.SQLGrammarException: could not execute native bulk manipulation query; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute native bulk manipulation query at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:318) at org.springframework.orm.jpa.aspectj.JpaExceptionTranslatorAspect.ajc$afterThrowing$org_springframework_orm_jpa_aspectj_JpaExceptionTranslatorAspect$1$18a1ac9(JpaExceptionTranslatorAspect.aj:15) at com.allinfinance.cis.batch.pboc.s1006.P1006.execute(P1006.java:28) at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:386) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130) at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:264) at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:76) at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:367) at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:214) at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:143) at org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:250) at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:195) at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:135) at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:61) at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:60) at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:144) at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:124) at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:135) at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:293) at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:120) at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:48) at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:114) at org.springframework.batch.core.launch.support.CommandLineJobRunner.start(CommandLineJobRunner.java:349) at org.springframework.batch.core.launch.support.CommandLineJobRunner.main(CommandLineJobRunner.java:574) Caused by: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute native bulk manipulation query at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1389) at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1317) at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:1399) at org.hibernate.ejb.AbstractQueryImpl.executeUpdate(AbstractQueryImpl.java:108) ... 22 more Caused by: org.hibernate.exception.SQLGrammarException: could not execute native bulk manipulation query at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.engine.query.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:219) at org.hibernate.impl.SessionImpl.executeNativeUpdate(SessionImpl.java:1310) at org.hibernate.impl.SQLQueryImpl.executeUpdate(SQLQueryImpl.java:396) at org.hibernate.ejb.QueryImpl.internalExecuteUpdate(QueryImpl.java:188) at org.hibernate.ejb.AbstractQueryImpl.executeUpdate(AbstractQueryImpl.java:99) ... 22 more Caused by: com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-440, SQLSTATE=42884, SQLERRMC=PROCEDURE11;PROCEDURE, DRIVER=3.59.81 at com.ibm.db2.jcc.am.dd.a(dd.java:676) at com.ibm.db2.jcc.am.dd.a(dd.java:60) at com.ibm.db2.jcc.am.dd.a(dd.java:127) at com.ibm.db2.jcc.am.bn.c(bn.java:2546) at com.ibm.db2.jcc.am.bn.d(bn.java:2534) at com.ibm.db2.jcc.am.bn.a(bn.java:2026) at com.ibm.db2.jcc.t4.cb.g(cb.java:140) at com.ibm.db2.jcc.t4.cb.d(cb.java:76) at com.ibm.db2.jcc.t4.q.d(q.java:63) at com.ibm.db2.jcc.t4.rb.l(rb.java:170) at com.ibm.db2.jcc.am.bn.hb(bn.java:2021) at com.ibm.db2.jcc.am.cn.rc(cn.java:3024) at com.ibm.db2.jcc.am.cn.b(cn.java:3784) at com.ibm.db2.jcc.am.cn.cc(cn.java:715) at com.ibm.db2.jcc.am.cn.executeUpdate(cn.java:698) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105) at org.hibernate.engine.query.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:210) ... 26 more
要炸,请求各位给予解答,万分感谢