Package 

Interface ReactivePanacheQuery


  • 
    public interface ReactivePanacheQuery<Entity extends Object>
    
                        

    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.

    • Method Detail

      • page

         abstract Page page()

        Returns the current page.

      • hasNextPage

         abstract Uni<Boolean> hasNextPage()

        Returns true if there is another page to read after the current one. This will cause reading of the entity count.

      • hasPreviousPage

         abstract Boolean hasPreviousPage()

        Returns true if there is a page to read before the current one.

      • pageCount

         abstract Uni<Integer> pageCount()

        Returns the total number of pages to be read using the current page size. This will cause reading of the entity count.

      • range

         abstract ReactivePanacheQuery<Entity> range(Integer startIndex, Integer lastIndex)

        Switch the query to use a fixed range (start index - last index) instead of a page. As the range is fixed, subsequent pagination of the query is not possible.

        Parameters:
        startIndex - the index of the first element, starting at 0
        lastIndex - the index of the last element
      • withCollation

         abstract ReactivePanacheQuery<Entity> withCollation(Collation collation)

        Define the collation used for this query.

        Parameters:
        collation - the collation to be used for this query.
      • withReadPreference

         abstract ReactivePanacheQuery<Entity> withReadPreference(ReadPreference readPreference)

        Define the read preference used for this query.

        Parameters:
        readPreference - the read preference to be used for this query.
      • count

         abstract Uni<Long> count()

        Reads and caches the total number of entities this query operates on. This causes a database query with SELECT COUNT(*) and a query equivalent to the current query, minus ordering.

      • stream

         abstract Multi<Entity> stream()

        Returns the current page of results as a Stream.

      • firstResult

         abstract Uni<Entity> firstResult()

        Returns the first result of the current page index. This ignores the current page size to fetch a single result.

      • singleResult

         abstract Uni<Entity> singleResult()

        Executes this query for the current page and return a single result.