Closed
Description
Bug description
With a30aaac in 5.0.0-M4 it is no longer possible to use queries in RepositoryItemReader()
or RepositoryItemReaderBuilder
that return a different type than the repository's entity type.
Environment
JKD 17.0.3, Spring Boot 3.0.0-M4
Steps to reproduce
Update from Spring Boot 3.0.0-M3 to 3.0.0-M4.
Expected behavior
Same behavior as in .
Minimal Complete Reproducible example
Simplified illustrative example:
Consider something like the following repository.
public interface TestRepository extends JpaRepository<TestEntity, Long> {
@Query(value = "SELECT e.id FROM TestEntity e")
Page<String> getFromCustomQuery(Pageable pageable);
}
With the following batch configuration.
@Configuration
public class TestConfig {
private final TestRepository testRepository;
@Bean
@StepScope
protected RepositoryItemReader<String> testItemReader() throws Exception {
final var itemReader = new RepositoryItemReader<String>();
itemReader.setRepository(testRepository);
itemReader.setPageSize(1000);
itemReader.setSort(Map.of("id", Sort.Direction.ASC));
itemReader.setMethodName("getFromCustomQuery");
itemReader.afterPropertiesSet();
return itemReader;
}
}