Skip to content

Documentation enhancement: Add more usable examples in Limiting Query Results #45031

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

Closed
Hdvlp opened this issue Apr 8, 2025 · 1 comment
Closed
Labels
for: external-project For an external project and not something we can fix status: invalid An issue that we don't feel is valid

Comments

@Hdvlp
Copy link

Hdvlp commented Apr 8, 2025

The documentation of Limiting Query Results can be enhanced by adding more usable examples.

I have added a repository to show that some example code builds and some fails. It is a time-saver to see more usable examples and use these examples before running into problems I encountered earlier in the error messages.

To handle At least 1 parameter(s) provided but only 0 parameter(s) present in query properly, a developer needs to know if the parameter inside the method name or if the parameter inside the brackets should be added. This is a potentially confusing area just by looking at this line of error message.

    User findByUsername(String username); // builds
    User findByLastname(String lastname); // builds
    User findFirstOrderByUsername(String username); // builds
    User findFirstOrderByLastname(String username); // builds

    User findFirstByOrderByUsernameAsc(); // builds
    User findFirstByOrderByLastnameAsc(); // builds
    User findFirstByOrderByFirstnameAsc(); // builds

    User findFirstByLastnameOrderByUsernameAsc(String lastname); // builds
    User findFirstByLastnameOrderByLastnameAsc(String lastname); // builds
    User findFirstByLastnameOrderByFirstnameAsc(String lastname); // builds
    User findFirstByLastnameOrderByIdAsc(String lastname); // builds

    User findFirstByUsernameOrderByUsernameAsc(String username); // builds
    User findFirstByUsernameOrderByUsername(String username); // builds
    User findFirstByUsernameOrderByUsernameDesc(String username); // builds

    User findFirstByOrderByUsername(String username); // fails to build

    User findFirstByOrderByUsernameAsc(String username); // fails to build

@Hdvlp Hdvlp changed the title Documentation enhancement: Add more usables in Limiting Query Results Documentation enhancement: Add more usable examples in Limiting Query Results Apr 8, 2025
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 8, 2025
@bclozel
Copy link
Member

bclozel commented Apr 8, 2025

I think you meant to create this issue against spring-data-jpa as this documentation is not maintained in this project. Thanks!

@bclozel bclozel closed this as not planned Won't fix, can't repro, duplicate, stale Apr 8, 2025
@bclozel bclozel added status: invalid An issue that we don't feel is valid for: external-project For an external project and not something we can fix and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

3 participants