/** * Configures a {@link PreparedStatementSetter} that will use the List as the values * to be set on the query to be executed for this reader. * * @param args values to set on the query * @return this instance for method chaining * @throws Exception from {@link InitializingBean#afterPropertiesSet()} */ public JdbcCursorItemReaderBuilder<T> queryArguments(List<?> args) throws Exception { ListPreparedStatementSetter listPreparedStatementSetter = new ListPreparedStatementSetter(args); listPreparedStatementSetter.afterPropertiesSet(); this.preparedStatementSetter = listPreparedStatementSetter; return this; }
@Before public void onSetUpInTransaction() throws Exception { List<Long> parameters = new ArrayList<>(); parameters.add(1L); parameters.add(4L); pss = new ListPreparedStatementSetter(parameters); }
@Before public void onSetUpInTransaction() throws Exception { itemReader = new JdbcCursorItemReader<>(); itemReader.setDataSource(dataSource); itemReader.setSql("select ID, NAME, VALUE from T_FOOS where ID > ? and ID < ?"); itemReader.setIgnoreWarnings(true); itemReader.setVerifyCursorPosition(true); itemReader.setRowMapper(new FooRowMapper()); itemReader.setFetchSize(10); itemReader.setMaxRows(100); itemReader.setQueryTimeout(1000); itemReader.setSaveState(true); List<Long> parameters = new ArrayList<>(); parameters.add(1L); parameters.add(4L); ListPreparedStatementSetter pss = new ListPreparedStatementSetter(parameters); itemReader.setPreparedStatementSetter(pss); }
@Transactional @Test(expected = IllegalArgumentException.class) public void testAfterPropertiesSet() throws Exception { pss = new ListPreparedStatementSetter(null); pss.afterPropertiesSet(); }
@Test public void testConfiguration() { ListPreparedStatementSetter preparedStatementSetter = new ListPreparedStatementSetter(Collections.EMPTY_LIST);
/** * Configures a {@link PreparedStatementSetter} that will use the List as the values * to be set on the query to be executed for this reader. * * @param args values to set on the query * @return this instance for method chaining * @throws Exception from {@link InitializingBean#afterPropertiesSet()} */ public JdbcCursorItemReaderBuilder<T> queryArguments(List<?> args) throws Exception { ListPreparedStatementSetter listPreparedStatementSetter = new ListPreparedStatementSetter(args); listPreparedStatementSetter.afterPropertiesSet(); this.preparedStatementSetter = listPreparedStatementSetter; return this; }