Entity
- The entity type being queriedpublic interface PanacheQuery<Entity>
Interface representing an entity query, which abstracts the use of paging, getting the number of results, and
operating on List
or Stream
.
Instances of this interface cannot mutate the query itself or its parameters: only paging information can be modified, and instances of this interface can be reused to obtain multiple pages of results.
Modifier and Type | Method and Description |
---|---|
long |
count()
Reads and caches the total number of entities this query operates on.
|
<T extends Entity> |
firstPage()
Sets the current page to the first page
|
<T extends Entity> |
firstResult()
Returns the first result of the current page index.
|
boolean |
hasNextPage()
Returns true if there is another page to read after the current one.
|
boolean |
hasPreviousPage()
Returns true if there is a page to read before the current one.
|
<T extends Entity> |
lastPage()
Sets the current page to the last page.
|
<T extends Entity> |
list()
Returns the current page of results as a
List . |
<T extends Entity> |
nextPage()
Sets the current page to the next page
|
Page |
page()
Returns the current page.
|
<T extends Entity> |
page(int pageIndex,
int pageSize)
Sets the current page.
|
<T extends Entity> |
page(Page page)
Sets the current page.
|
int |
pageCount()
Returns the total number of pages to be read using the current page size.
|
<T extends Entity> |
previousPage()
Sets the current page to the previous page (or the first page if there is no previous page)
|
<T extends Entity> |
singleResult()
Executes this query for the current page and return a single result.
|
<T extends Entity> |
stream()
Returns the current page of results as a
Stream . |
<T extends Entity> PanacheQuery<T> page(Page page)
page
- the new pagepage(int, int)
,
page()
<T extends Entity> PanacheQuery<T> page(int pageIndex, int pageSize)
pageIndex
- the page indexpageSize
- the page sizepage(Page)
,
page()
<T extends Entity> PanacheQuery<T> nextPage()
previousPage()
<T extends Entity> PanacheQuery<T> previousPage()
nextPage()
<T extends Entity> PanacheQuery<T> firstPage()
lastPage()
<T extends Entity> PanacheQuery<T> lastPage()
firstPage()
,
count()
boolean hasNextPage()
hasPreviousPage()
,
count()
boolean hasPreviousPage()
hasNextPage()
int pageCount()
Page page()
page(Page)
,
page(int,int)
long count()
SELECT COUNT(*)
and a query equivalent to the current query, minus
ordering.<T extends Entity> List<T> list()
List
.List
.stream()
,
page(Page)
,
page()
<T extends Entity> Stream<T> stream()
Stream
.Stream
.list()
,
page(Page)
,
page()
<T extends Entity> T firstResult()
singleResult()
<T extends Entity> T singleResult()
javax.persistence.NoResultException
- if there is no resultjavax.persistence.NonUniqueResultException
- if there are more than one resultfirstResult()
Copyright © 2019 JBoss by Red Hat. All rights reserved.