Skip to content

Instantly share code, notes, and snippets.

@tkstone
Created April 23, 2019 01:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tkstone/3cebeb30632e3946358a97560042e78b to your computer and use it in GitHub Desktop.
Save tkstone/3cebeb30632e3946358a97560042e78b to your computer and use it in GitHub Desktop.
<batch:job id="TestJob01" job-repository="jobRepository">
<batch:step id="SimpleStep">
<batch:tasklet transaction-manager="testTransactionManager" allow-start-if-complete="true">
<batch:chunk
reader="TestReader"
processor="TestProcessor"
writer="TestWriter"
commit-interval="1"
reader-transactional-queue="false"
/>
</batch:tasklet>
</batch:step>
</batch:job>
<bean id="SourceMapper"
class="test.rowmapper.TbSourceMapper"/>
<bean id="TestReader"
class="org.springframework.batch.item.database.JdbcCursorItemReader"
scope="step">
<property name="dataSource" ref="testDataSource"/>
<property name="sql"
value="SELECT COL1, COL2, COL3
FROM TB_SOURCE"/>
<property name="rowMapper"
ref="SourceMapper"/>
<property name="fetchSize" value="100" />
<property name="maxRows" value="0" />
</bean>
<bean id="TestProcessor"
class="test.processor.TestProcessor"
scope="step">
</bean>
<bean id="TestWriter"
class="org.springframework.batch.item.database.JdbcBatchItemWriter"
scope="step">
<property name="assertUpdates" value="true" />
<property name="itemSqlParameterSourceProvider">
<bean class="org.springframework.batch.item.database.BeanPropertyItemSqlParameterSourceProvider" />
</property>
<property name="sql"
value="INSERT INTO TB_TARGET(NEW_COL1, NEW_COL2, NEW_COL3)
VALUES(:newCol1, :newCol2, :newCol3)"
/>
<property name="dataSource" ref="testDataSource" />
</bean>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment