这是我的配置:
<batch:job id="catastaleBatchJobSvecchia" job-repository="jobRepository">
<batch:step id="catastalePerimetroStep">
<batch:tasklet task-executor="taskExecutor" throttle-limit="${CHECK_CATASTALE.THROTTLE_LIMIT}" >
<batch:chunk reader="pagingQueryPerimetro" processor="itemPerimetroProcessor" writer="itemWriter" commit-interval="${CHECK_CATASTALE.COMMIT_BATCH}">
</batch:chunk>
</batch:tasklet>
</batch:step>
</batch:job>
<beans:bean id="pagingQuery" class="org.springframework.batch.item.database.support.SqlPagingQueryProviderFactoryBean">
<beans:property name="dataSource" ref="synthDS"/>
<beans:property name="selectClause" value="SELECT RC.EXT_CODICE_FISCALE AS CODICE_FISCALE"/>
<beans:property name="fromClause" value="FROM RAPPORTO_CATASTALE RC, DOCUMENTO D"/>
<beans:property name="whereClause" value="WHERE RC.ATTUALE = 'S'
AND RC.ID_DOCUMENTO = D.ID_DOCUMENTO
AND D.DT_OSCURAMENTO IS NULL"/>
<beans:property name="sortKey" value="RC.DT_AGGIORNAMENTO" />
</beans:bean>
<beans:bean id="pagingQueryPerimetro" class="org.springframework.batch.item.database.JdbcPagingItemReader">
<beans:property name="dataSource" ref="synthDS"/>
<beans:property name="queryProvider" ref="pagingQuery"/>
<beans:property name="pageSize" value="${CHECK_CATASTALE.NUMERO_POSIZIONI_IN_PERIMETRO}"/>
<beans:property name="fetchSize" value="${CHECK_CATASTALE.NUMERO_POSIZIONI_IN_PERIMETRO}"/>
<beans:property name="rowMapper">
<beans:bean class="it.cervedgroup.datiimmobiliari.batch.checkcatastale.mapper.SoggettoPerimetroPlusRowMapper"/>
</beans:property>
</beans:bean>
运行时出现以下错误:
org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar** [SELECT * FROM (SELECT RC.EXT_CODICE_FISCALE AS CODICE_FISCALE, ROWNUM as TMP_ROW_NUM FROM RAPPORTO_CATASTALE RC, DOCUMENTO D WHERE RC.ATTUALE = 'S' AND RC.ID_DOCUMENTO = D.ID_DOCUMENTO AND D.DT_OSCURAMENTO IS NULL ORDER BY RC.DT_AGGIORNAMENTO ASC) WHERE ROWNUM <= 100]; nested exception is java.sql.SQLException: Nome colonna non valido
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:237)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:407)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:456)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:464)
at org.springframework.batch.item.database.JdbcPagingItemReader.doReadPage(JdbcPagingItemReader.java:208)
at org.springframework.batch.item.database.AbstractPagingItemReader.doRead(AbstractPagingItemReader.java:107)
at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.read(AbstractItemCountingItemStreamItemReader.java:85)
at org.springframework.batch.core.step.item.SimpleChunkProvider.doRead(SimpleChunkProvider.java:90)
at org.springframework.batch.core.step.item.SimpleChunkProvider.read(SimpleChunkProvider.java:148)
at org.springframework.batch.core.step.item.SimpleChunkProvider$1.doInIteration(SimpleChunkProvider.java:108)
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.item.SimpleChunkProvider.provide(SimpleChunkProvider.java:103)
at org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:68)
at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:386)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131)
at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:264)
但查询正确且列名正确