-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
We are using spring-data-jpa to perform a query using a JpaRepository that returns a Page object. I am seeing different behaviour with spring-data-jpa 3.4.2 compared to spring-data-jpa 3.4.3.
Use-case
- There are 44 records in my database table that should be found when running the query.
- I am asking paged results, with a page size of 20 and page number 1 (the second).
3.4.2
- The resulting page has a total of 44, independent of the page number I requested.
3.4.3
- The resulting page has a varying total, depending on the page number I requested:
- page number 0 --> total = 20
- page number 1 --> total = 40
- page number 2 --> total = 44
I could not find anything in the release notes, and in my (not-so-informed) opinion the behaviour in 3.4.2 makes more sense. This feels like a bug to me.
I would appreciate any response, whether it's an explanation why this new result is better or whether it's a confirmation that I've indeed found a bug.
If this issue is not according to your standards, please let me know.
Edit
SimpleJpaRepository.readPage() returns a total of 44 independent of the specified page number (i.e. is correct).
JpaQueryExecution.doExecute() returns a total of 20/40/44 depending on the page number (i.e. is incorrect).
One of our endpoints does the search via a .findAll() call on a JpaRepository, which will trigger the SimpleJpaRepository.readPage() call, while another endpoint of us does the search via a custom method annotated with @query on a JpaRepository, which will trigger the JpaQueryExecution.doExecute().
Hopefully this helps. It helped me see that we have a possible work-around, though I still think there is a bug that should be resolved.