Class AbstractHibernateQuery<T,​Q extends AbstractHibernateQuery<T,​Q>>

    • Field Detail

      • cacheable

        @Nullable
        protected @Nullable java.lang.Boolean cacheable
      • readOnly

        @Nullable
        protected @Nullable java.lang.Boolean readOnly
      • cacheRegion

        @Nullable
        protected @Nullable java.lang.String cacheRegion
      • comment

        @Nullable
        protected @Nullable java.lang.String comment
      • fetchSize

        protected int fetchSize
      • lockModes

        protected final java.util.Map<Path<?>,​org.hibernate.LockMode> lockModes
      • flushMode

        @Nullable
        protected @Nullable org.hibernate.FlushMode flushMode
      • timeout

        protected int timeout
    • Constructor Detail

      • AbstractHibernateQuery

        public AbstractHibernateQuery​(org.hibernate.Session session)
    • Method Detail

      • fetchCount

        public long fetchCount()
      • createQuery

        public org.hibernate.query.Query createQuery()
        Expose the original Hibernate query for the given projection
        Returns:
        query
      • iterate

        public com.mysema.commons.lang.CloseableIterator<T> iterate()
        Return the query results as an Iterator. If the query contains multiple results pre row, the results are returned in an instance of Object[].

        Entities returned as results are initialized on demand. The first SQL query returns identifiers only.
      • stream

        public java.util.stream.Stream<T> stream()
      • logQuery

        protected void logQuery​(java.lang.String queryString)
      • scroll

        public org.hibernate.ScrollableResults scroll​(org.hibernate.ScrollMode mode)
        Return the query results as ScrollableResults. The scrollability of the returned results depends upon JDBC driver support for scrollable ResultSets.
        Parameters:
        mode - scroll mode
        Returns:
        scrollable results
      • setCacheable

        public Q setCacheable​(boolean cacheable)
        Enable caching of this query result set.
        Parameters:
        cacheable - Should the query results be cacheable?
      • setCacheRegion

        public Q setCacheRegion​(java.lang.String cacheRegion)
        Set the name of the cache region.
        Parameters:
        cacheRegion - the name of a query cache region, or null for the default query cache
      • setComment

        public Q setComment​(java.lang.String comment)
        Add a comment to the generated SQL.
        Parameters:
        comment - comment
        Returns:
        the current object
      • setFetchSize

        public Q setFetchSize​(int fetchSize)
        Set a fetchJoin size for the underlying JDBC query.
        Parameters:
        fetchSize - the fetchJoin size
        Returns:
        the current object
      • setLockMode

        public Q setLockMode​(Path<?> path,
                             org.hibernate.LockMode lockMode)
        Set the lock mode for the given path.
        Returns:
        the current object
      • setFlushMode

        public Q setFlushMode​(org.hibernate.FlushMode flushMode)
        Override the current session flush mode, just for this query.
        Returns:
        the current object
      • setReadOnly

        public Q setReadOnly​(boolean readOnly)
        Entities retrieved by this query will be loaded in a read-only mode where Hibernate will never dirty-check them or make changes persistent.
        Returns:
        the current object
      • setTimeout

        public Q setTimeout​(int timeout)
        Set a timeout for the underlying JDBC query.
        Parameters:
        timeout - the timeout in seconds
        Returns:
        the current object
      • clone

        protected void clone​(Q query)
      • clone

        public Q clone​(org.hibernate.Session session)
        Clone the state of this query to a new instance with the given Session
        Parameters:
        session - session
        Returns:
        cloned query
      • clone

        public Q clone​(org.hibernate.StatelessSession session)
        Clone the state of this query to a new instance with the given StatelessSession
        Parameters:
        session - session
        Returns:
        cloned query