Use named parameters in queries Spring batch -
i have spring batch job in step follows:
<bean id="abstractreader" class="org.springframework.batch.item.database.jdbccursoritemreader" abstract="true"> <property name="fetchsize" value="1000"/> <property name="verifycursorposition" value="true"/> <property name="rowmapper"> <bean class="org.springframework.jdbc.core.columnmaprowmapper"/> </property> </bean> <bean id="masterreader" parent="abstractreader" abstract="true"> <property name="fetchsize" value="1000"/> <property name="datasource" ref="masterdatasource"/> </bean> <bean id="abstractwriter" class="org.springframework.batch.item.database.jdbcbatchitemwriter" abstract="true"> <property name="assertupdates" value="false"/> <property name="itempreparedstatementsetter"> <bean class="org.springframework.batch.item.database.support.columnmapitempreparedstatementsetter"/> </property> </bean> <bean id="masterwriter" parent="abstractwriter" abstract="true"> <property name="datasource" ref="masterdatasource"/> </bean> <bean id="tempwriter" parent="masterwriter" scope="step"> <property name="sql" value="${insert_query}"/> </bean> <bean id="tempreader" parent="masterreader" scope="step"> <property name="sql" value="${select_query}"/> </bean> <batch:step id="tempstep"> <batch:tasklet> <batch:chunk commit-interval="100" reader="tempreader" writer="tempwriter"/> </batch:tasklet> </batch:step>
is there way bring named parameter support in queries? jdbccursoritemreader using preparedstatement. (too many ? in queries now)
there isn't way jdbccursoritemreader
can jdbcpagingitemreader
. can read more reader in documentation here: https://docs.spring.io/spring-batch/apidocs/org/springframework/batch/item/database/jdbcpagingitemreader.html
Comments
Post a Comment