question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Property handle pagination in Spring Data JPA custom queries

See original GitHub issue

Currently pagination does not work for Spring Data JPA methods that use a custom @Query. Basically an incorrect count query is generated. The count query should be generated using the countQuery method of the @Query annotation. This will most likely require a small change in PanacheQueryImpl to accept the count query (or create a subclass in the spring-data-jpa module to that will override the count method).

Also if no countQuery is specified, then the count query should probably be derived from the name of the method, as is specified in the Javadoc of @Query.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
uaihebertcommented, Dec 6, 2019

hello, here there is the project that reproduces this issue: https://github.com/uaihebert/quarkus-small-issues

If you search for ISSUE-3 in the code you will be able to find the query that is failing

0reactions
geoandcommented, Dec 10, 2019

@uaihebert you are welcome!

Read more comments on GitHub >

github_iconTop Results From Across the Web

spring data jpa @query and pageable - java - Stack Overflow
You can use pagination with a native query. It is documented here: Spring Data JPA - Reference Documentation. "You can however use native...
Read more >
Pagination and Sorting using Spring Data JPA - Baeldung
Learn how to paginate and sort query results in Spring Data JPA. ... in Spring Data JPA to define custom queries using JPQL...
Read more >
Spring Data Pageable with custom query in Spring Boot
Spring Data Pageable example with custom Query in Spring Boot - pagination and sorting with custom Query and JPA Pageable.
Read more >
Spring Data JPA Tutorial: Pagination - Petri Kainulainen
If we want create the Pageable object manually, the service class (or other component) that wants to paginate the query results, which are ......
Read more >
Ultimate Guide: Custom Queries with Spring Data JPA's ...
Ultimate Guide: Custom Queries with Spring Data JPA's @Query Annotation · 1 JPQL Queries. 1.1 Defining a Custom JPQL Query; 1.2 Sorting Your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found