PanacheQuery.range()

See original GitHub issue

Description PanacheQuery support a paging mechanism that allow to fetch the result of a query page by page. This is handy to list all the result of a query but not to give an external application the capability to fetch all the results.

Moreover, paging is statefull as it implies to store the size of the page and the current page index.

In API developement, range query is often implemented by providing an extra query parameter ?range=0-10, this is suitable to be used with HTTP range headers defined in the follwing RFC; https://tools.ietf.org/html/rfc7233

Building such range capability where a user can ask for any range within the list of result is not suitable with the current paging implementation.

So I propose to add a PanacheQuery.range() method for this.

Implementation ideas Add a PanacheQuery.range(startIdx, endIdx) method that will allow to set offset and limit on the generated SQL query as the current paging mechanism do.

If it’s OK, I can works on a PR for this.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:22 (21 by maintainers)

github_iconTop GitHub Comments

5reactions
marceloverdijkcommented, Jan 18, 2020

I would also be interested in a standard offset / limit query.

1reaction
pilhuhncommented, Feb 19, 2020

I also have a use case for this, where the current paging approach makes it hard to implement.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Simplified Hibernate ORM with Panache - Quarkus
The PanacheQuery type has many other methods to deal with paging and returning streams. Using a range instead of pages. PanacheQuery also allows...
Read more >
PanacheQuery (Quarkus - Hibernate ORM with Panache
Interface representing an entity query, which abstracts the use of paging, getting the number of results, and operating on List or Stream ....
Read more >
Improvements/addons to Hibernate with Panache
PanacheQuery.range(int startIdx, int lastIdx) 5. JPA Query: Issue: parts of https://github.com/quarkusio/quarkus/issues/3483. Proposed implementation:
Read more >
io.quarkus.hibernate.reactive.panache.common.runtime ...
CommonPanacheQueryImpl.range() taken from open source projects. ... @Override public <T extends Enreplacedy> PanacheQuery<T> range(int startIndex, ...
Read more >
pagination in quarkus backend and java - Stack Overflow
... quarkus and trying to get query result in quarkus using PanacheQuery.findAll().page( pageIndex,pageSize).list(); I run my query in data ...
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