Property handle pagination in Spring Data JPA custom queries
See original GitHub issueCurrently 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:
- Created 4 years ago
- Comments:7 (7 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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
@uaihebert you are welcome!