Class HibernateOrmSearchQueryAdapter<R>

  • All Implemented Interfaces:
    Query, TypedQuery<R>, org.hibernate.query.CommonQueryContract, org.hibernate.query.MutationQuery, org.hibernate.query.Query<R>, org.hibernate.query.SelectionQuery<R>, org.hibernate.query.spi.DomainQueryExecutionContext, org.hibernate.query.spi.QueryImplementor<R>

    @SuppressForbiddenApis(reason="We need to use the internal QueryOptionsImpl in order to implement a org.hibernate.query.Query")
    public final class HibernateOrmSearchQueryAdapter<R>
    extends org.hibernate.query.spi.AbstractQuery<R>
    • Field Summary

      • Fields inherited from class org.hibernate.query.spi.AbstractSelectionQuery

        CRITERIA_HQL_STRING
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      HibernateOrmSearchQueryAdapter<R> applyGraph​(org.hibernate.graph.RootGraph graph, org.hibernate.graph.GraphSemantic semantic)  
      protected void beforeQuery()  
      static <R> HibernateOrmSearchQueryAdapter<R> create​(SearchQuery<R> query)  
      protected int doExecuteUpdate()  
      protected List<R> doList()  
      protected org.hibernate.query.spi.ScrollableResultsImplementor<R> doScroll​(org.hibernate.ScrollMode scrollMode)  
      int executeUpdate()
      Execute an update or delete statement.
      Map<String,​Object> getHints()
      Get the properties and hints and associated values that are in effect for the query instance.
      LockModeType getLockMode()
      Get the current lock mode for the query.
      org.hibernate.LockOptions getLockOptions()  
      org.hibernate.query.spi.QueryParameterBindings getParameterBindings()  
      org.hibernate.query.spi.ParameterMetadataImplementor getParameterMetadata()  
      org.hibernate.query.spi.QueryParameterBindings getQueryParameterBindings()  
      String getQueryString()  
      List<R> list()  
      protected <P> org.hibernate.query.spi.QueryParameterBinding<P> locateBinding​(int position)  
      protected <P> org.hibernate.query.spi.QueryParameterBinding<P> locateBinding​(Parameter<P> parameter)  
      protected <P> org.hibernate.query.spi.QueryParameterBinding<P> locateBinding​(String name)  
      protected <P> org.hibernate.query.spi.QueryParameterBinding<P> locateBinding​(org.hibernate.query.spi.QueryParameterImplementor<P> parameter)  
      org.hibernate.query.spi.ScrollableResultsImplementor<R> scroll()  
      HibernateOrmSearchQueryAdapter<R> setHint​(String hintName, Object value)
      Set a query property or hint.
      HibernateOrmSearchQueryAdapter<R> setLockMode​(LockModeType lockModeType)
      Set the lock mode type to be used for the query execution.
      HibernateOrmSearchQueryAdapter<R> setLockMode​(String alias, org.hibernate.LockMode lockMode)  
      org.hibernate.query.spi.QueryImplementor<R> setResultListTransformer​(org.hibernate.query.ResultListTransformer<R> resultListTransformer)  
      HibernateOrmSearchQueryAdapter<R> setTimeout​(int timeout)  
      <T> org.hibernate.query.spi.QueryImplementor<T> setTupleTransformer​(org.hibernate.query.TupleTransformer<T> transformer)  
      String toString()  
      <T> T unwrap​(Class<T> cls)
      Return an object of the specified type to allow access to the provider-specific API.
      • Methods inherited from class org.hibernate.query.spi.AbstractQuery

        addQueryHint, applyOptions, collectHints, getComment, getFirstResult, getFlushMode, getMaxResults, getParameters, getQueryOptions, getSupportedHints, isCacheable, prepareForExecution, resolveJdbcParameterTypeIfNecessary, setCacheable, setCacheMode, setCacheRegion, setCacheRetrieveMode, setCacheStoreMode, setComment, setFetchSize, setFirstResult, setFlushMode, setHibernateFlushMode, setLockOptions, setMaxResults, setOptionalEntityName, setOptionalId, setOptionalObject, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setParameterList, setProperties, setProperties, setReadOnly
      • Methods inherited from class org.hibernate.query.spi.AbstractSelectionQuery

        afterQuery, afterQuery, applyOptions, buildTupleMetadata, checkQueryReturnType, getCacheMode, getCacheRegion, getCacheRetrieveMode, getCacheStoreMode, getCallback, getFetchSize, getHibernateLockMode, getSessionFactory, getSingleResult, getSingleResultOrNull, hasAppliedGraph, hasCallbackActions, hasLimit, isReadOnly, requiresTxn, resetCallback, scroll, setAliasSpecificLockMode, setFollowOnLocking, setHibernateLockMode, stream, uniqueElement, uniqueResult, uniqueResultOptional, verifyResultType, visitQueryReturnType
      • Methods inherited from class org.hibernate.query.spi.AbstractCommonQueryContract

        applyAdditionalPossibleHints, applyAliasSpecificLockModeHint, applyCacheableHint, applyCacheModeHint, applyCacheRegionHint, applyCommentHint, applyEntityGraphHint, applyFetchSizeHint, applyFirstResult, applyFlushModeHint, applyFollowOnLockingHint, applyGraph, applyGraph, applyHibernateLockMode, applyHint, applyJpaCacheRetrieveModeHint, applyJpaCacheStoreModeHint, applyJpaFlushMode, applyLockModeHint, applyLockModeType, applyLockTimeoutHint, applyLockTimeoutHint, applyMaxResults, applyResultListTransformer, applySelectionHint, applySynchronizeSpacesHint, applyTimeoutHint, applyTupleTransformer, determineType, getHibernateFlushMode, getIntegerLiteral, getJpaFlushMode, getMaxRows, getParameter, getParameter, getParameter, getParameter, getParameterValue, getParameterValue, getParameterValue, getSession, getTimeout, isBound, putIfNotNull, putIfNotNull
      • Methods inherited from interface org.hibernate.query.CommonQueryContract

        getHibernateFlushMode, getTimeout
      • Methods inherited from interface org.hibernate.query.spi.DomainQueryExecutionContext

        getSession
      • Methods inherited from interface org.hibernate.query.Query

        applyFetchGraph, applyLoadGraph, getResultList, getResultStream, getSingleResult, stream, uniqueResult, uniqueResultOptional
      • Methods inherited from interface org.hibernate.query.spi.QueryImplementor

        getSession, scroll, setResultTransformer
      • Methods inherited from interface org.hibernate.query.SelectionQuery

        getCacheMode, getCacheRegion, getCacheRetrieveMode, getCacheStoreMode, getFetchSize, getHibernateLockMode, getSingleResultOrNull, isReadOnly, setAliasSpecificLockMode, setFollowOnLocking, setHibernateLockMode
    • Method Detail

      • unwrap

        public <T> T unwrap​(Class<T> cls)
        Description copied from interface: Query
        Return an object of the specified type to allow access to the provider-specific API. If the provider's query implementation does not support the specified class, the PersistenceException is thrown.
        Parameters:
        cls - the class of the object to be returned. This is normally either the underlying query implementation class or an interface that it implements.
        Returns:
        an instance of the specified class
      • list

        public List<R> list()
        Specified by:
        list in interface org.hibernate.query.Query<R>
        Specified by:
        list in interface org.hibernate.query.SelectionQuery<R>
        Overrides:
        list in class org.hibernate.query.spi.AbstractSelectionQuery<R>
      • getQueryString

        public String getQueryString()
        Specified by:
        getQueryString in interface org.hibernate.query.Query<R>
        Specified by:
        getQueryString in class org.hibernate.query.spi.AbstractSelectionQuery<R>
      • setHint

        public HibernateOrmSearchQueryAdapter<R> setHint​(String hintName,
                                                         Object value)
        Description copied from interface: TypedQuery
        Set a query property or hint. The hints elements may be used to specify query properties and hints. Properties defined by this specification must be observed by the provider. Vendor-specific hints that are not recognized by a provider must be silently ignored. Portable applications should not rely on the standard timeout hint. Depending on the database in use and the locking mechanisms used by the provider, this hint may or may not be observed.
        Specified by:
        setHint in interface org.hibernate.query.CommonQueryContract
        Specified by:
        setHint in interface org.hibernate.query.MutationQuery
        Specified by:
        setHint in interface Query
        Specified by:
        setHint in interface org.hibernate.query.Query<R>
        Specified by:
        setHint in interface org.hibernate.query.SelectionQuery<R>
        Specified by:
        setHint in interface TypedQuery<R>
        Overrides:
        setHint in class org.hibernate.query.spi.AbstractQuery<R>
        Parameters:
        hintName - name of property or hint
        value - value for the property or hint
        Returns:
        the same query instance
      • setTimeout

        public HibernateOrmSearchQueryAdapter<R> setTimeout​(int timeout)
        Specified by:
        setTimeout in interface org.hibernate.query.CommonQueryContract
        Specified by:
        setTimeout in interface org.hibernate.query.MutationQuery
        Specified by:
        setTimeout in interface org.hibernate.query.Query<R>
        Specified by:
        setTimeout in interface org.hibernate.query.SelectionQuery<R>
        Overrides:
        setTimeout in class org.hibernate.query.spi.AbstractQuery<R>
      • scroll

        public org.hibernate.query.spi.ScrollableResultsImplementor<R> scroll()
        Specified by:
        scroll in interface org.hibernate.query.Query<R>
        Specified by:
        scroll in interface org.hibernate.query.spi.QueryImplementor<R>
        Specified by:
        scroll in interface org.hibernate.query.SelectionQuery<R>
        Overrides:
        scroll in class org.hibernate.query.spi.AbstractSelectionQuery<R>
      • doScroll

        protected org.hibernate.query.spi.ScrollableResultsImplementor<R> doScroll​(org.hibernate.ScrollMode scrollMode)
        Specified by:
        doScroll in class org.hibernate.query.spi.AbstractSelectionQuery<R>
      • doList

        protected List<R> doList()
        Specified by:
        doList in class org.hibernate.query.spi.AbstractSelectionQuery<R>
      • beforeQuery

        protected void beforeQuery()
        Overrides:
        beforeQuery in class org.hibernate.query.spi.AbstractSelectionQuery<R>
      • getHints

        public Map<String,​Object> getHints()
        Description copied from interface: Query
        Get the properties and hints and associated values that are in effect for the query instance.
        Specified by:
        getHints in interface Query
        Overrides:
        getHints in class org.hibernate.query.spi.AbstractCommonQueryContract
        Returns:
        query properties and hints
      • getParameterMetadata

        public org.hibernate.query.spi.ParameterMetadataImplementor getParameterMetadata()
        Specified by:
        getParameterMetadata in interface org.hibernate.query.Query<R>
        Specified by:
        getParameterMetadata in class org.hibernate.query.spi.AbstractCommonQueryContract
      • getParameterBindings

        public org.hibernate.query.spi.QueryParameterBindings getParameterBindings()
      • getQueryParameterBindings

        public org.hibernate.query.spi.QueryParameterBindings getQueryParameterBindings()
        Specified by:
        getQueryParameterBindings in interface org.hibernate.query.spi.DomainQueryExecutionContext
        Specified by:
        getQueryParameterBindings in class org.hibernate.query.spi.AbstractCommonQueryContract
      • locateBinding

        protected <P> org.hibernate.query.spi.QueryParameterBinding<P> locateBinding​(String name)
        Overrides:
        locateBinding in class org.hibernate.query.spi.AbstractCommonQueryContract
      • locateBinding

        protected <P> org.hibernate.query.spi.QueryParameterBinding<P> locateBinding​(int position)
        Overrides:
        locateBinding in class org.hibernate.query.spi.AbstractCommonQueryContract
      • locateBinding

        protected <P> org.hibernate.query.spi.QueryParameterBinding<P> locateBinding​(Parameter<P> parameter)
        Overrides:
        locateBinding in class org.hibernate.query.spi.AbstractCommonQueryContract
      • locateBinding

        protected <P> org.hibernate.query.spi.QueryParameterBinding<P> locateBinding​(org.hibernate.query.spi.QueryParameterImplementor<P> parameter)
        Overrides:
        locateBinding in class org.hibernate.query.spi.AbstractCommonQueryContract
      • setTupleTransformer

        public <T> org.hibernate.query.spi.QueryImplementor<T> setTupleTransformer​(org.hibernate.query.TupleTransformer<T> transformer)
        Specified by:
        setTupleTransformer in interface org.hibernate.query.Query<R>
        Specified by:
        setTupleTransformer in interface org.hibernate.query.spi.QueryImplementor<R>
        Overrides:
        setTupleTransformer in class org.hibernate.query.spi.AbstractQuery<R>
      • setResultListTransformer

        public org.hibernate.query.spi.QueryImplementor<R> setResultListTransformer​(org.hibernate.query.ResultListTransformer<R> resultListTransformer)
        Specified by:
        setResultListTransformer in interface org.hibernate.query.Query<R>
        Specified by:
        setResultListTransformer in interface org.hibernate.query.spi.QueryImplementor<R>
        Overrides:
        setResultListTransformer in class org.hibernate.query.spi.AbstractQuery<R>
      • setLockMode

        public HibernateOrmSearchQueryAdapter<R> setLockMode​(LockModeType lockModeType)
        Description copied from interface: TypedQuery
        Set the lock mode type to be used for the query execution.
        Specified by:
        setLockMode in interface Query
        Specified by:
        setLockMode in interface org.hibernate.query.Query<R>
        Specified by:
        setLockMode in interface org.hibernate.query.SelectionQuery<R>
        Specified by:
        setLockMode in interface TypedQuery<R>
        Overrides:
        setLockMode in class org.hibernate.query.spi.AbstractQuery<R>
        Parameters:
        lockModeType - lock mode
        Returns:
        the same query instance
      • getLockMode

        public LockModeType getLockMode()
        Description copied from interface: Query
        Get the current lock mode for the query. Returns null if a lock mode has not been set on the query object.
        Specified by:
        getLockMode in interface Query
        Specified by:
        getLockMode in interface org.hibernate.query.SelectionQuery<R>
        Overrides:
        getLockMode in class org.hibernate.query.spi.AbstractQuery<R>
        Returns:
        lock mode
      • getLockOptions

        public org.hibernate.LockOptions getLockOptions()
        Specified by:
        getLockOptions in interface org.hibernate.query.Query<R>
        Specified by:
        getLockOptions in interface org.hibernate.query.SelectionQuery<R>
        Overrides:
        getLockOptions in class org.hibernate.query.spi.AbstractQuery<R>
      • executeUpdate

        public int executeUpdate()
                          throws org.hibernate.HibernateException
        Description copied from interface: Query
        Execute an update or delete statement.
        Specified by:
        executeUpdate in interface org.hibernate.query.MutationQuery
        Specified by:
        executeUpdate in interface Query
        Specified by:
        executeUpdate in interface org.hibernate.query.Query<R>
        Overrides:
        executeUpdate in class org.hibernate.query.spi.AbstractQuery<R>
        Returns:
        the number of entities updated or deleted
        Throws:
        org.hibernate.HibernateException
      • doExecuteUpdate

        protected int doExecuteUpdate()
        Specified by:
        doExecuteUpdate in class org.hibernate.query.spi.AbstractQuery<R>
      • setLockMode

        public HibernateOrmSearchQueryAdapter<R> setLockMode​(String alias,
                                                             org.hibernate.LockMode lockMode)
        Specified by:
        setLockMode in interface org.hibernate.query.Query<R>
        Specified by:
        setLockMode in interface org.hibernate.query.SelectionQuery<R>
        Overrides:
        setLockMode in class org.hibernate.query.spi.AbstractQuery<R>