spring-projects / spring-projects/spring-batch
Unable to use projections in ItemReader
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3k
- Forks
- 2.5k
- Avg merge
- 6d 53m
- Merged PRs (30d)
- 3
Description
While tyring to use projections in item reader, always getting "NoSuchMethodException" (for the projection method in jpa repository). Tried multiple ways, although same works when invoking via say a controller.
Error:
Caused by: java.lang.NoSuchMethodException: jdk.proxy2.$Proxy115.findDistinctByCreatedAfter(java.time.LocalDate,org.springframework.data.domain.PageRequest)
at java.base/java.lang.Class.getMethod(Class.java:2405) ~[na:na]
Env: Spring Boot 3.X, JDK 17
Created a github demo project with all set up to demonstrate issue runtime
https://github.com/jobas2007/batch-h2-demo
Expected behavior is to be able to use projection fitting into batch processing
All details are in the stackoverflow
https://stackoverflow.com/questions/79002944/purge-group-of-old-records-iteratively-to-insert-fresh-data-daily
Appreciate any help/assistance/suggestions, as been struggling for a while now. Thanks
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the linked batch-h2-demo and reproduce the NoSuchMethodException from the ItemReader projection path. Compare that behavior with the controller invocation described in the issue, then verify that the projection method works during batch processing without the exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, spring-boot
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100