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

[Bug]: Allow to configure intial page number #941

Open
hantsy opened this issue Jan 14, 2025 · 2 comments
Open

[Bug]: Allow to configure intial page number #941

hantsy opened this issue Jan 14, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@hantsy
Copy link

hantsy commented Jan 14, 2025

Specification Version

1.0.1

Bug report

I have used Quarkus, Spring Data, and Micronaut Data, all of which provide pagination features. However, by default, the initial page number is 0.

It is a start number convention in Java language(except for reading JDBC field positions).

But in Jakarta Data spec, it seems the pagination starts at 1, which confused me, and I had to adjust my usage in the previous experience.

I hope there is a config to setup the initial page number is 0 or 1.

Let's developers decide.

Additional information

No response

@hantsy hantsy added the bug Something isn't working label Jan 14, 2025
@gavinking
Copy link
Contributor

I noticed this when we were working on 1.0, and thought it was a little bit strange (the equivalent Page object in Hibernate has 0-based indexing) but I didn't think it was worth arguing about. Sorry about that.

But 1.0 is already final, so we should not be messing about and changing this now.

It is a start number convention in Java language(except for reading JDBC field positions).

It's certainly more common in Java, but IIRC there's also places in JPA and in JPQL where indexing is 1-based so people just need to be on the lookout for that. 0-based indexing is not a universal convention.

@gavinking
Copy link
Contributor

Note that Limit.startAt is also 1-based, so Jakarta Data is self-consistent here (though it does disagree with JPA's setFirstResult()).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants