Class DBQuery<T>

  • All Implemented Interfaces:
    com.querydsl.core.Fetchable<T>, com.querydsl.core.FetchableQuery<T,​com.querydsl.jpa.JPQLQuery<T>>, com.querydsl.core.FilteredClause<com.querydsl.jpa.JPQLQuery<T>>, com.querydsl.core.Query<com.querydsl.jpa.JPQLQuery<T>>, com.querydsl.core.SimpleQuery<com.querydsl.jpa.JPQLQuery<T>>, com.querydsl.core.support.ExtendedSubQuery<T>, com.querydsl.core.types.Expression<T>, com.querydsl.core.types.SubQueryExpression<T>, com.querydsl.jpa.JPQLQuery<T>, Serializable

    public class DBQuery<T>
    extends com.querydsl.jpa.impl.AbstractJPAQuery<T,​DBQuery<T>>
    Custom query for Querydsl
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class com.querydsl.jpa.impl.AbstractJPAQuery

        entityManager, flushMode, hints, lockMode, projection, queryHandler
      • Fields inherited from class com.querydsl.jpa.JPAQueryBase

        queryMixin
      • Fields inherited from class com.querydsl.core.support.QueryBase

        MDC_PARAMETERS, MDC_QUERY
    • Constructor Summary

      Constructors 
      Constructor Description
      DBQuery​(javax.persistence.EntityManager entityManager, com.querydsl.jpa.JPQLTemplates templates, ConversionHandler conversionHandler, SessionData sessionData)
      Creates a new EntityManager bound query
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      DBQuery<T> clone​(javax.persistence.EntityManager entityManager)  
      DBQuery<T> clone​(javax.persistence.EntityManager entityManager, com.querydsl.jpa.JPQLTemplates templates)  
      int count()
      Deprecated.
      int count​(com.querydsl.core.types.dsl.NumberPath<?> path)
      Counts the number of rows using the id path as base
      protected javax.persistence.Query createQuery​(com.querydsl.core.QueryModifiers modifiers, boolean forCount)  
      com.mysema.commons.lang.CloseableIterator<T> export()
      Iterates over results for exporting data.
      com.mysema.commons.lang.CloseableIterator<com.querydsl.core.Tuple> export​(com.querydsl.core.types.Expression<?>... projections)
      Iterates over results for exporting data with a tuple projection.
      <RT> com.mysema.commons.lang.CloseableIterator<RT> export​(com.querydsl.core.types.Expression<RT> projection)
      Iterates over results for exporting data with a given projection.
      <RT> com.mysema.commons.lang.CloseableIterator<RT> export​(Class<RT> resultType, com.querydsl.core.types.Expression<?> projection)
      Iterates over results for exporting data converting each result.
      DBQuery<T> fetchJoin()
      Deprecated.
      Set<T> fetchSet()
      Returns the results with current projection as a set
      SessionData getSessionData()  
      boolean hasEmptyResults()
      Returns whether the execution of this query yields zero rows
      boolean hasResults()
      Returns whether the execution of this query yields at least one row
      DBQuery<T> ignoreMaxResults()
      Deprecated.
      This method will be removed in 4.17.
      DBQuery<T> innerFetchHint​(com.querydsl.core.types.Path<?>... path)
      Set the hint to fetch relationships with inner join
      boolean isIgnoreMaxResults()
      Deprecated.
      This method will be removed in 4.17.
      com.mysema.commons.lang.CloseableIterator<T> iterate()
      Iterates over all results, without applying any limit.
      com.mysema.commons.lang.CloseableIterator<com.querydsl.core.Tuple> iterate​(com.querydsl.core.types.Expression<?>... projections)
      Iterates over all results for a given tuple projection, without applying any limit.
      <RT> com.mysema.commons.lang.CloseableIterator<RT> iterate​(com.querydsl.core.types.Expression<RT> projection)
      Iterates over all results with a given projection, without applying any limit.
      <RT> com.mysema.commons.lang.CloseableIterator<RT> iterate​(Class<RT> resultType, com.querydsl.core.types.Expression<?> projection)
      Iterates over all results converting each result, without applying any limit.
      DBQuery<T> leftFetchHint​(com.querydsl.core.types.Path<?>... path)
      Set the hint to fetch relationships with left join
      List<com.querydsl.core.Tuple> list​(com.querydsl.core.types.Expression<?>... projections)
      Returns a list of tuples
      <RT> List<RT> list​(com.querydsl.core.types.Expression<RT> projection)
      Returns a list
      <RT> List<RT> list​(Class<RT> resultType, com.querydsl.core.types.Expression<?> expr)
      Returns a list converted into the given type
      <K,​V>
      Map<K,​V>
      map​(com.querydsl.core.types.Expression<K> keyExpr, com.querydsl.core.types.Expression<V> valueExpr)
      Returns the results as a Map, with an expression as key and the other one as value
      <RT> Page<RT> page​(Class<RT> resultType, Integer currentPage, Integer pageSize, boolean skipTotalCount, com.querydsl.core.types.Expression<?> expr)
      Executes a paged search, converted into the given type, based on the default page size
      <RT> Page<RT> page​(Class<RT> resultType, QueryParameters queryParameters, com.querydsl.core.types.Expression<?> expr)
      Returns a paged search, getting page parameters from the given QueryParameters, converting the result
      <RT> Page<RT> page​(Integer currentPage, Integer pageSize, boolean skipTotalCount, com.querydsl.core.types.Expression<RT> expr)
      Executes a paged search
      <RT> Page<RT> page​(QueryParameters queryParameters, com.querydsl.core.types.Expression<RT> expr)
      Returns a paged search, getting page parameters from the given QueryParameters
      <RT> RT requiredUniqueResult​(com.querydsl.core.types.Expression<RT> expr)
      Makes sure that the result is unique.
      <RT> RT requiredUniqueResult​(Class<RT> resultType, com.querydsl.core.types.Expression<?> expr)
      Returns the result of requiredUniqueResult(Expression) converted into the given resultType
      DBQuery<com.querydsl.core.Tuple> select​(com.querydsl.core.types.Expression<?>... exprs)  
      <U> DBQuery<U> select​(com.querydsl.core.types.Expression<U> expr)  
      Set<com.querydsl.core.Tuple> set​(com.querydsl.core.types.Expression<?>... projections)
      Returns a set of tuples
      <RT> Set<RT> set​(com.querydsl.core.types.Expression<RT> projection)
      Returns a set
      <RT> Set<RT> set​(Class<RT> resultType, com.querydsl.core.types.Expression<?> expr)
      Returns a set converted into the given type
      void setIgnoreMaxResults​(boolean ignoreMaxResults)
      Deprecated.
      This method will be removed in 4.17.
      com.querydsl.core.Tuple singleResult​(com.querydsl.core.types.Expression<?>... exprs)
      Returns the first result as a Tuple
      <RT> RT singleResult​(com.querydsl.core.types.Expression<RT> expr)
      Returns the first result
      <RT> RT singleResult​(Class<RT> resultType, com.querydsl.core.types.Expression<?> expr)
      Returns the first result in the query, converted into the given type, or null if no records found
      Stream<T> stream()
      Returns the results with current projection as a stream
      Stream<com.querydsl.core.Tuple> stream​(com.querydsl.core.types.Expression<?>... projections)
      Returns a stream
      <RT> Stream<RT> stream​(com.querydsl.core.types.Expression<RT> projection)
      Returns a stream
      • Methods inherited from class com.querydsl.jpa.impl.AbstractJPAQuery

        cleanupMDC, clone, clone, createQuery, createSerializer, fetch, fetchCount, fetchOne, fetchResults, logQuery, reset, setFlushMode, setHint, setLockMode
      • Methods inherited from class com.querydsl.jpa.JPAQueryBase

        fetchAll, from, from, from, getTemplates, innerJoin, innerJoin, innerJoin, innerJoin, innerJoin, innerJoin, join, join, join, join, join, join, leftJoin, leftJoin, leftJoin, leftJoin, leftJoin, leftJoin, on, on, rightJoin, rightJoin, rightJoin, rightJoin, rightJoin, rightJoin, serialize, serialize, toString
      • Methods inherited from class com.querydsl.core.support.FetchableSubQueryBase

        accept, contains, contains, eq, eq, exists, getMetadata, getType, goe, goe, gt, gt, hashCode, in, in, isNotNull, isNull, loe, loe, lt, lt, ne, ne, notExists
      • Methods inherited from class com.querydsl.core.support.FetchableQueryBase

        equals, fetchFirst, transform, uniqueResult
      • Methods inherited from class com.querydsl.core.support.QueryBase

        distinct, groupBy, groupBy, having, having, limit, offset, orderBy, orderBy, restrict, set, where, where
      • Methods inherited from interface com.querydsl.core.types.Expression

        accept, getType
      • Methods inherited from interface com.querydsl.core.support.ExtendedSubQuery

        contains, contains, eq, eq, exists, goe, goe, gt, gt, in, in, isNotNull, isNull, loe, loe, lt, lt, ne, ne, notExists
      • Methods inherited from interface com.querydsl.core.Fetchable

        fetchFirst
      • Methods inherited from interface com.querydsl.core.FetchableQuery

        transform
      • Methods inherited from interface com.querydsl.core.FilteredClause

        where
      • Methods inherited from interface com.querydsl.core.Query

        groupBy, having
      • Methods inherited from interface com.querydsl.core.SimpleQuery

        distinct, limit, offset, orderBy, restrict, set
      • Methods inherited from interface com.querydsl.core.types.SubQueryExpression

        getMetadata
    • Constructor Detail

      • DBQuery

        public DBQuery​(javax.persistence.EntityManager entityManager,
                       com.querydsl.jpa.JPQLTemplates templates,
                       ConversionHandler conversionHandler,
                       SessionData sessionData)
        Creates a new EntityManager bound query
    • Method Detail

      • clone

        public DBQuery<T> clone​(javax.persistence.EntityManager entityManager)
        Specified by:
        clone in class com.querydsl.jpa.impl.AbstractJPAQuery<T,​DBQuery<T>>
      • clone

        public DBQuery<T> clone​(javax.persistence.EntityManager entityManager,
                                com.querydsl.jpa.JPQLTemplates templates)
        Specified by:
        clone in class com.querydsl.jpa.impl.AbstractJPAQuery<T,​DBQuery<T>>
      • count

        @Deprecated
        public int count()
        Deprecated.
        Returns the number of results in the query. Use count(NumberPath) instead, as future versions of QueryDSL will change the behavior of count(), making it very inefficient.
      • count

        public int count​(com.querydsl.core.types.dsl.NumberPath<?> path)
        Counts the number of rows using the id path as base
      • export

        public com.mysema.commons.lang.CloseableIterator<T> export()
        Iterates over results for exporting data. Applies the max results in the configuration.
      • export

        public <RT> com.mysema.commons.lang.CloseableIterator<RT> export​(Class<RT> resultType,
                                                                         com.querydsl.core.types.Expression<?> projection)
        Iterates over results for exporting data converting each result. Applies the max results in the configuration.
      • export

        public com.mysema.commons.lang.CloseableIterator<com.querydsl.core.Tuple> export​(com.querydsl.core.types.Expression<?>... projections)
        Iterates over results for exporting data with a tuple projection. Applies the max results in the configuration.
      • export

        public <RT> com.mysema.commons.lang.CloseableIterator<RT> export​(com.querydsl.core.types.Expression<RT> projection)
        Iterates over results for exporting data with a given projection. Applies the max results in the configuration.
      • fetchSet

        public Set<T> fetchSet()
        Returns the results with current projection as a set
      • hasEmptyResults

        public boolean hasEmptyResults()
        Returns whether the execution of this query yields zero rows
      • hasResults

        public boolean hasResults()
        Returns whether the execution of this query yields at least one row
      • ignoreMaxResults

        @Deprecated
        public DBQuery<T> ignoreMaxResults()
        Deprecated.
        This method will be removed in 4.17.
        No longer used. Only left during 4.16.x to avoid breaking scripts.
      • innerFetchHint

        public DBQuery<T> innerFetchHint​(com.querydsl.core.types.Path<?>... path)
        Set the hint to fetch relationships with inner join
      • isIgnoreMaxResults

        @Deprecated
        public boolean isIgnoreMaxResults()
        Deprecated.
        This method will be removed in 4.17.
        No longer used. Only left during 4.16.x to avoid breaking scripts.
      • iterate

        public com.mysema.commons.lang.CloseableIterator<T> iterate()
        Iterates over all results, without applying any limit. Warning: this method may return a large number of results, and should be used with caution.
        Specified by:
        iterate in interface com.querydsl.core.Fetchable<T>
        Overrides:
        iterate in class com.querydsl.jpa.impl.AbstractJPAQuery<T,​DBQuery<T>>
      • iterate

        public <RT> com.mysema.commons.lang.CloseableIterator<RT> iterate​(Class<RT> resultType,
                                                                          com.querydsl.core.types.Expression<?> projection)
        Iterates over all results converting each result, without applying any limit. Warning: this method may return a large number of results, and should be used with caution.
      • iterate

        public com.mysema.commons.lang.CloseableIterator<com.querydsl.core.Tuple> iterate​(com.querydsl.core.types.Expression<?>... projections)
        Iterates over all results for a given tuple projection, without applying any limit. Warning: this method may return a large number of results, and should be used with caution.
      • iterate

        public <RT> com.mysema.commons.lang.CloseableIterator<RT> iterate​(com.querydsl.core.types.Expression<RT> projection)
        Iterates over all results with a given projection, without applying any limit. Warning: this method may return a large number of results, and should be used with caution.
      • leftFetchHint

        public DBQuery<T> leftFetchHint​(com.querydsl.core.types.Path<?>... path)
        Set the hint to fetch relationships with left join
      • list

        public <RT> List<RT> list​(Class<RT> resultType,
                                  com.querydsl.core.types.Expression<?> expr)
        Returns a list converted into the given type
      • list

        public List<com.querydsl.core.Tuple> list​(com.querydsl.core.types.Expression<?>... projections)
        Returns a list of tuples
      • list

        public <RT> List<RT> list​(com.querydsl.core.types.Expression<RT> projection)
        Returns a list
      • map

        public <K,​V> Map<K,​V> map​(com.querydsl.core.types.Expression<K> keyExpr,
                                              com.querydsl.core.types.Expression<V> valueExpr)
        Returns the results as a Map, with an expression as key and the other one as value
      • page

        public <RT> Page<RT> page​(Class<RT> resultType,
                                  Integer currentPage,
                                  Integer pageSize,
                                  boolean skipTotalCount,
                                  com.querydsl.core.types.Expression<?> expr)
        Executes a paged search, converted into the given type, based on the default page size
      • page

        public <RT> Page<RT> page​(Class<RT> resultType,
                                  QueryParameters queryParameters,
                                  com.querydsl.core.types.Expression<?> expr)
        Returns a paged search, getting page parameters from the given QueryParameters, converting the result
      • page

        public <RT> Page<RT> page​(Integer currentPage,
                                  Integer pageSize,
                                  boolean skipTotalCount,
                                  com.querydsl.core.types.Expression<RT> expr)
        Executes a paged search
      • page

        public <RT> Page<RT> page​(QueryParameters queryParameters,
                                  com.querydsl.core.types.Expression<RT> expr)
        Returns a paged search, getting page parameters from the given QueryParameters
      • select

        public DBQuery<com.querydsl.core.Tuple> select​(com.querydsl.core.types.Expression<?>... exprs)
      • select

        public <U> DBQuery<U> select​(com.querydsl.core.types.Expression<U> expr)
      • set

        public <RT> Set<RT> set​(Class<RT> resultType,
                                com.querydsl.core.types.Expression<?> expr)
        Returns a set converted into the given type
      • set

        public Set<com.querydsl.core.Tuple> set​(com.querydsl.core.types.Expression<?>... projections)
        Returns a set of tuples
      • set

        public <RT> Set<RT> set​(com.querydsl.core.types.Expression<RT> projection)
        Returns a set
      • setIgnoreMaxResults

        @Deprecated
        public void setIgnoreMaxResults​(boolean ignoreMaxResults)
        Deprecated.
        This method will be removed in 4.17.
        No longer used. Only left during 4.16.x to avoid breaking scripts.
      • singleResult

        public <RT> RT singleResult​(Class<RT> resultType,
                                    com.querydsl.core.types.Expression<?> expr)
        Returns the first result in the query, converted into the given type, or null if no records found
      • singleResult

        public com.querydsl.core.Tuple singleResult​(com.querydsl.core.types.Expression<?>... exprs)
        Returns the first result as a Tuple
      • singleResult

        public <RT> RT singleResult​(com.querydsl.core.types.Expression<RT> expr)
        Returns the first result
      • stream

        public Stream<T> stream()
        Returns the results with current projection as a stream
      • stream

        public Stream<com.querydsl.core.Tuple> stream​(com.querydsl.core.types.Expression<?>... projections)
        Returns a stream
      • stream

        public <RT> Stream<RT> stream​(com.querydsl.core.types.Expression<RT> projection)
        Returns a stream
      • createQuery

        protected javax.persistence.Query createQuery​(com.querydsl.core.QueryModifiers modifiers,
                                                      boolean forCount)
        Overrides:
        createQuery in class com.querydsl.jpa.impl.AbstractJPAQuery<T,​DBQuery<T>>