Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page has an incorrect total since 3.4.3 #3802

Open
Roberto-Mol opened this issue Mar 5, 2025 · 1 comment
Open

Page has an incorrect total since 3.4.3 #3802

Roberto-Mol opened this issue Mar 5, 2025 · 1 comment
Labels
status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged

Comments

@Roberto-Mol
Copy link

Roberto-Mol commented Mar 5, 2025

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.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 5, 2025
@mp911de
Copy link
Member

mp911de commented Mar 6, 2025

If you would like us to spend some time helping you to diagnose the problem, please spend some time describing it and, ideally, providing a minimal yet complete sample that reproduces the problem.
You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.

@mp911de mp911de added the status: waiting-for-feedback We need additional information before we can continue label Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

No branches or pull requests

3 participants