Class PanacheQueryImpl<Entity>

    • Constructor Detail

      • PanacheQueryImpl

        PanacheQueryImpl​(io.smallrye.mutiny.Uni<org.hibernate.reactive.mutiny.Mutiny.Session> em,
                         String query,
                         String orderBy,
                         Object paramsArrayOrMap)
    • Method Detail

      • project

        public <T> PanacheQuery<T> project​(Class<T> type)
        Description copied from interface: PanacheQuery
        Defines a projection class: the getters, and the public fields, will be used to restrict which fields should be retrieved from the database.
        Specified by:
        project in interface PanacheQuery<Entity>
        Returns:
        a new query with the same state as the previous one (params, page, range, lockMode, hints, ...).
      • pageCount

        public io.smallrye.mutiny.Uni<Integer> pageCount()
        Description copied from interface: PanacheQuery
        Returns the total number of pages to be read using the current page size. This will cause reading of the entity count.
        Specified by:
        pageCount in interface PanacheQuery<Entity>
        Returns:
        the total number of pages to be read using the current page size.
      • range

        public <T extends EntityPanacheQuery<T> range​(int startIndex,
                                                        int lastIndex)
        Description copied from interface: PanacheQuery
        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.
        Specified by:
        range in interface PanacheQuery<Entity>
        Parameters:
        startIndex - the index of the first element, starting at 0
        lastIndex - the index of the last element
        Returns:
        this query, modified
      • withLock

        public <T extends EntityPanacheQuery<T> withLock​(javax.persistence.LockModeType lockModeType)
        Description copied from interface: PanacheQuery
        Define the locking strategy used for this query.
        Specified by:
        withLock in interface PanacheQuery<Entity>
        Parameters:
        lockModeType - the locking strategy to be used for this query.
        Returns:
        this query, modified
      • withHint

        public <T extends EntityPanacheQuery<T> withHint​(String hintName,
                                                           Object value)
        Description copied from interface: PanacheQuery
        Set a query property or hint on the underlying JPA Query.
        Specified by:
        withHint in interface PanacheQuery<Entity>
        Parameters:
        hintName - name of the property or hint.
        value - value for the property or hint.
        Returns:
        this query, modified
      • filter

        public <T extends EntityPanacheQuery<T> filter​(String filterName,
                                                         io.quarkus.panache.common.Parameters parameters)
        Description copied from interface: PanacheQuery

        Enables a Hibernate filter during fetching of results for this query. Your filter must be declared with FilterDef on your entity or package, and enabled with Filter on your entity.

        WARNING: setting filters can only be done on the underlying Hibernate Session and so this will modify the session's filters for the duration of obtaining the results (not while building the query). Enabled filters will be removed from the session afterwards, but no effort is made to preserve filters enabled on the session outside of this API.

        Specified by:
        filter in interface PanacheQuery<Entity>
        Parameters:
        filterName - The name of the filter to enable
        parameters - The set of parameters for the filter, if the filter requires parameters
        Returns:
        this query, modified
      • filter

        public <T extends EntityPanacheQuery<T> filter​(String filterName,
                                                         Map<String,​Object> parameters)
        Description copied from interface: PanacheQuery

        Enables a Hibernate filter during fetching of results for this query. Your filter must be declared with FilterDef on your entity or package, and enabled with Filter on your entity.

        WARNING: setting filters can only be done on the underlying Hibernate Session and so this will modify the session's filters for the duration of obtaining the results (not while building the query). Enabled filters will be removed from the session afterwards, but no effort is made to preserve filters enabled on the session outside of this API.

        Specified by:
        filter in interface PanacheQuery<Entity>
        Parameters:
        filterName - The name of the filter to enable
        parameters - The set of parameters for the filter, if the filter requires parameters
        Returns:
        this query, modified
      • filter

        public <T extends EntityPanacheQuery<T> filter​(String filterName)
        Description copied from interface: PanacheQuery

        Enables a Hibernate filter during fetching of results for this query. Your filter must be declared with FilterDef on your entity or package, and enabled with Filter on your entity.

        WARNING: setting filters can only be done on the underlying Hibernate Session and so this will modify the session's filters for the duration of obtaining the results (not while building the query). Enabled filters will be removed from the session afterwards, but no effort is made to preserve filters enabled on the session outside of this API.

        Specified by:
        filter in interface PanacheQuery<Entity>
        Parameters:
        filterName - The name of the filter to enable
        Returns:
        this query, modified
      • count

        public io.smallrye.mutiny.Uni<Long> count()
        Description copied from interface: PanacheQuery
        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.
        Specified by:
        count in interface PanacheQuery<Entity>
        Returns:
        the total number of entities this query operates on, cached.
      • firstResult

        public <T extends Entity> io.smallrye.mutiny.Uni<T> firstResult()
        Description copied from interface: PanacheQuery
        Returns the first result of the current page index. This ignores the current page size to fetch a single result.
        Specified by:
        firstResult in interface PanacheQuery<Entity>
        Returns:
        the first result of the current page index, or null if there are no results.
        See Also:
        PanacheQuery.singleResult()