I need to connect with jpa repository from ItemReader using spring batch for Database to text file export. But as of now i tried using JdbcCursorItemReader class to retrieve the data from db. I need to connect with Repository using spring data jpa.
Below is my code used
@Bean
public ItemReader<Object> databaseCsvItemReader(@Qualifier("dataSource") DataSource dataSource) throws Exception {
JdbcCursorItemReader<Object> reader = new JdbcCursorItemReader<Object>();
reader.setSql(QUERY);
reader.setDataSource(dataSource);
reader.setRowMapper(new BeanPropertyRowMapper<>(Object.class));
return reader;
}
From this reader i need to connect using Jpa instead of normal jdbc, anyone can help me on this or references it might help me to use jpa.