I had spring batch application and configured step like this:
ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
taskExecutor.setCorePoolSize(4);
taskExecutor.setMaxPoolSize(10);
taskExecutor.afterPropertiesSet();
return this.stepBuilderFactory.get("step1")
.<Mymodel, Mymodel>chunk(2500)
.reader(reader())
.writer(writer())
.taskExecutor(taskExecutor)
.build();
And reader like this:
@Bean
public JdbcCursorItemReader<Mymodel> reader() {
JdbcCursorItemReader<Mymodel> reader = new JdbcCursorItemReader<Mymodel>();
reader.setDataSource(dataSource);
reader.setSql("select * from User");
reader.setRowMapper(new BeanPropertyRowMapper<>(Mymodel.class));
reader.setVerifyCursorPosition(false);
return reader;
}
When I execute application , getting this error:
org.springframework.jdbc.UncategorizedSQLException: Attempt to process next row failed; uncategorized SQLException for SQL [select * from User]; SQL state [99999]; error code [17289]; Result set after last row; nested exception is java.sql.SQLException: Result set after last row
Can you please help me to solve this.