I'm setting up an ItemRepositoryReader for the reader in a springBatch step.
public ItemReader<EcheanceEntity> reader(){
RepositoryItemReader<EcheanceEntity> reader = new RepositoryItemReader<EcheanceEntity>();
reader.setRepository(echeanceRepository);
reader.setMethodName("findById");
List parameters = new ArrayList();
long a = 0;
parameters.add(a);
reader.setArguments(parameters);
Map<String, Direction> sort = new HashMap<String, Direction>();
sort.put("id", Direction.ASC);
reader.setSort(sort);
return reader;
}
this is the line in my repository.
public interface EcheanceRepository extends JpaRepository<EcheanceEntity, Long>{
public EcheanceEntity findById(long id);
@Override
public List<EcheanceEntity> findAll();
If a use the method findAll(), so without any arguments, it works fine. But if I use the method findById(long id) I get "no such method exception, findById(java.lang.Long, org.springframework.data.domain.PageRequest)" from the ItemRepositoryReader. The method works fine without using the reader when I'm testing it by using immediately the repository.
Thank you.