类 CriteriaQueryTypeQueryAdapter<X>

  • 所有已实现的接口:
    javax.persistence.Query, javax.persistence.TypedQuery<X>, BasicQueryContract<CommonQueryContract>, Query<X>, CommonQueryContract, Query<X>, QueryImplementor<X>

    public class CriteriaQueryTypeQueryAdapter<X>
    extends Object
    implements QueryImplementor<X>
    Make this go away in 6.0 :)

    Needed because atm we render a JPA Criteria query into a HQL/JPQL query String and some metadata, and then compile into a Query. This class wraps the compiled HQL/JPQL query and adds an extra layer of metadata.

    But the move to SQM in 6.0 allows us to do away with the "wrapping". Essentially

    作者:
    Steve Ebersole
    • 方法详细资料

      • getResultList

        public List<X> getResultList()
        指定者:
        getResultList 在接口中 javax.persistence.Query
        指定者:
        getResultList 在接口中 Query<X>
        指定者:
        getResultList 在接口中 javax.persistence.TypedQuery<X>
      • uniqueResult

        public X uniqueResult()
        从接口复制的说明: Query
        Convenience method to return a single instance that matches the query, or null if the query returns no results.
        指定者:
        uniqueResult 在接口中 Query<X>
        指定者:
        uniqueResult 在接口中 Query<X>
        返回:
        the single result or null
      • stream

        public Stream<X> stream()
        从接口复制的说明: Query
        Retrieve a Stream over the query results.

        In the initial implementation (5.2) this returns a simple sequential Stream. The plan is to return a a smarter stream in 6.x leveraging the SQM model.

        You should call BaseStream.close() after processing the stream so that the underlying resources are deallocated right away.

        指定者:
        stream 在接口中 Query<X>
        返回:
        The results Stream
      • list

        public List<X> list()
        从接口复制的说明: Query
        Return the query results as a List. If the query contains multiple results per row, the results are returned in an instance of Object[].
        指定者:
        list 在接口中 Query<X>
        指定者:
        list 在接口中 Query<X>
        返回:
        the result list
      • isCacheable

        public boolean isCacheable()
        从接口复制的说明: Query
        Are the results of this query eligible for second level query caching? This is different than second level caching of any returned entities and collections. NOTE: the query being "eligible" for caching does not necessarily mean its results will be cached. Second level query caching still has to be enabled on the SessionFactory for this to happen. Usually that is controlled by the hibernate.cache.use_query_cache configuration setting.
        指定者:
        isCacheable 在接口中 BasicQueryContract<X>
        指定者:
        isCacheable 在接口中 Query<X>
        返回:
        true if the query results are eligible for caching, false otherwise.
        另请参阅:
        AvailableSettings.USE_QUERY_CACHE
      • getSingleResult

        public X getSingleResult()
        指定者:
        getSingleResult 在接口中 javax.persistence.Query
        指定者:
        getSingleResult 在接口中 Query<X>
        指定者:
        getSingleResult 在接口中 javax.persistence.TypedQuery<X>
      • getNamedParameters

        public String[] getNamedParameters()
        从接口复制的说明: Query
        Return the names of all named parameters of the query.
        指定者:
        getNamedParameters 在接口中 Query<X>
        返回:
        the parameter names, in no particular order
      • getMaxResults

        public int getMaxResults()
        指定者:
        getMaxResults 在接口中 javax.persistence.Query
      • setMaxResults

        public QueryImplementor<X> setMaxResults​(int maxResult)
        指定者:
        setMaxResults 在接口中 javax.persistence.Query
        指定者:
        setMaxResults 在接口中 Query<X>
        指定者:
        setMaxResults 在接口中 Query<X>
        指定者:
        setMaxResults 在接口中 javax.persistence.TypedQuery<X>
      • getFirstResult

        public int getFirstResult()
        指定者:
        getFirstResult 在接口中 javax.persistence.Query
      • setFirstResult

        public QueryImplementor<X> setFirstResult​(int i)
        指定者:
        setFirstResult 在接口中 javax.persistence.Query
        指定者:
        setFirstResult 在接口中 Query<X>
        指定者:
        setFirstResult 在接口中 Query<X>
        指定者:
        setFirstResult 在接口中 javax.persistence.TypedQuery<X>
      • getHints

        public Map<String,​Object> getHints()
        指定者:
        getHints 在接口中 javax.persistence.Query
      • setHint

        public QueryImplementor<X> setHint​(String name,
                                           Object value)
        指定者:
        setHint 在接口中 javax.persistence.Query
        指定者:
        setHint 在接口中 Query<X>
        指定者:
        setHint 在接口中 Query<X>
        指定者:
        setHint 在接口中 javax.persistence.TypedQuery<X>
      • applyGraph

        public QueryImplementor<X> applyGraph​(RootGraph graph,
                                              GraphSemantic semantic)
        从接口复制的说明: Query
        Apply the given graph using the given semantic
        指定者:
        applyGraph 在接口中 Query<X>
        参数:
        graph - The graph the apply.
        semantic - The semantic to use when applying the graph
        返回:
        this - for method chaining
      • isNativeQuery

        protected boolean isNativeQuery()
      • getFlushMode

        public javax.persistence.FlushModeType getFlushMode()
        从接口复制的说明: Query
        For users of the Hibernate native APIs, we've had to rename this method as defined by Hibernate historically because the JPA contract defines a method of the same name, but returning the JPA FlushModeType rather than Hibernate's FlushMode. For the former behavior, use Query.getHibernateFlushMode() instead.
        指定者:
        getFlushMode 在接口中 javax.persistence.Query
        指定者:
        getFlushMode 在接口中 Query<X>
        返回:
        The FlushModeType in effect for this query.
      • getQueryOptions

        public RowSelection getQueryOptions()
        从接口复制的说明: Query
        "QueryOptions" is a better name, I think, than "RowSelection" -> 6.0
        指定者:
        getQueryOptions 在接口中 Query<X>
        返回:
        Return the encapsulation of this query's options, which includes access to firstRow, maxRows, timeout and fetchSize. Important because this gives access to those values in their Integer form rather than the primitive form (int) required by JPA.
      • setFlushMode

        public QueryImplementor<X> setFlushMode​(javax.persistence.FlushModeType flushModeType)
        指定者:
        setFlushMode 在接口中 javax.persistence.Query
        指定者:
        setFlushMode 在接口中 Query<X>
        指定者:
        setFlushMode 在接口中 Query<X>
        指定者:
        setFlushMode 在接口中 javax.persistence.TypedQuery<X>
      • getCacheRegion

        public String getCacheRegion()
        从接口复制的说明: Query
        Obtain the name of the second level query cache region in which query results will be stored (if they are cached, see the discussion on Query.isCacheable() for more information). null indicates that the default region should be used.
        指定者:
        getCacheRegion 在接口中 BasicQueryContract<X>
        指定者:
        getCacheRegion 在接口中 Query<X>
        指定者:
        getCacheRegion 在接口中 Query<X>
        返回:
        The specified cache region name into which query results should be placed; null indicates the default region.
      • setTimeout

        public QueryImplementor setTimeout​(int timeout)
        从接口复制的说明: Query
        Set the query timeout in seconds. NOTE it is important to understand that any value set here is eventually passed directly through to the JDBC Statement which expressly disallows negative values. So negative values should be avoided as a general rule.
        指定者:
        setTimeout 在接口中 BasicQueryContract<X>
        指定者:
        setTimeout 在接口中 Query<X>
        指定者:
        setTimeout 在接口中 Query<X>
        参数:
        timeout - the timeout in seconds
        返回:
        this, for method chaining
        另请参阅:
        Query.getTimeout()
      • setLockMode

        public QueryImplementor setLockMode​(String alias,
                                            LockMode lockMode)
        从接口复制的说明: Query
        Set the LockMode to use for specific alias (as defined in the query's FROM clause). The alias-specific lock modes specified here are added to the query's internal LockOptions. The effect of these alias-specific LockModes is somewhat dependent on the driver/database in use. Generally speaking, for maximum portability, this method should only be used to mark that the rows corresponding to the given alias should be included in pessimistic locking (LockMode.PESSIMISTIC_WRITE).
        指定者:
        setLockMode 在接口中 Query<X>
        指定者:
        setLockMode 在接口中 Query<X>
        参数:
        alias - a query alias, or "this" for a collection filter
        lockMode - The lock mode to apply.
        返回:
        this, for method chaining
        另请参阅:
        Query.getLockOptions()
      • getComment

        public String getComment()
        从接口复制的说明: Query
        Obtain the comment currently associated with this query. Provided SQL commenting is enabled (generally by enabling the hibernate.use_sql_comments config setting), this comment will also be added to the SQL query sent to the database. Often useful for identifying the source of troublesome queries on the database side.
        指定者:
        getComment 在接口中 Query<X>
        指定者:
        getComment 在接口中 Query<X>
        返回:
        The comment.
      • addQueryHint

        public QueryImplementor addQueryHint​(String hint)
        从接口复制的说明: Query
        Add a DB query hint to the SQL. These differ from JPA's QueryHint, which is specific to the JPA implementation and ignores DB vendor-specific hints. Instead, these are intended solely for the vendor-specific hints, such as Oracle's optimizers. Multiple query hints are supported; the Dialect will determine concatenation and placement.
        指定者:
        addQueryHint 在接口中 Query<X>
        指定者:
        addQueryHint 在接口中 Query<X>
        参数:
        hint - The database specific query hint to add.
      • iterate

        public Iterator<X> iterate()
        从接口复制的说明: Query
        Return the query results as an Iterator. If the query contains multiple results per 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.
        指定者:
        iterate 在接口中 Query<X>
        返回:
        the result iterator
      • scroll

        public ScrollableResults scroll()
        从接口复制的说明: Query
        Return the query results as ScrollableResults. The scrollability of the returned results depends upon JDBC driver support for scrollable ResultSets.

        You should call ScrollableResults.close() after processing the ScrollableResults so that the underlying resources are deallocated right away.

        指定者:
        scroll 在接口中 Query<X>
        指定者:
        scroll 在接口中 Query<X>
        返回:
        the result iterator
        另请参阅:
        ScrollableResults
      • scroll

        public ScrollableResults scroll​(ScrollMode scrollMode)
        从接口复制的说明: Query
        Return the query results as ScrollableResults. The scrollability of the returned results depends upon JDBC driver support for scrollable ResultSets.

        You should call ScrollableResults.close() after processing the ScrollableResults so that the underlying resources are deallocated right away.

        指定者:
        scroll 在接口中 Query<X>
        指定者:
        scroll 在接口中 Query<X>
        参数:
        scrollMode - The scroll mode
        返回:
        the result iterator
        另请参阅:
        ScrollableResults, ScrollMode
      • getLockMode

        public javax.persistence.LockModeType getLockMode()
        指定者:
        getLockMode 在接口中 javax.persistence.Query
      • setLockMode

        public QueryImplementor<X> setLockMode​(javax.persistence.LockModeType lockModeType)
        指定者:
        setLockMode 在接口中 javax.persistence.Query
        指定者:
        setLockMode 在接口中 Query<X>
        指定者:
        setLockMode 在接口中 Query<X>
        指定者:
        setLockMode 在接口中 javax.persistence.TypedQuery<X>
      • getParameters

        public Set<javax.persistence.Parameter<?>> getParameters()
        指定者:
        getParameters 在接口中 javax.persistence.Query
      • isBound

        public boolean isBound​(javax.persistence.Parameter<?> param)
        指定者:
        isBound 在接口中 javax.persistence.Query
      • getParameterValue

        public <T> T getParameterValue​(javax.persistence.Parameter<T> param)
        指定者:
        getParameterValue 在接口中 javax.persistence.Query
      • setParameter

        public <T> QueryImplementor<X> setParameter​(javax.persistence.Parameter<T> param,
                                                    T t)
        指定者:
        setParameter 在接口中 javax.persistence.Query
        指定者:
        setParameter 在接口中 Query<X>
        指定者:
        setParameter 在接口中 Query<X>
        指定者:
        setParameter 在接口中 javax.persistence.TypedQuery<X>
      • setParameter

        public QueryImplementor<X> setParameter​(javax.persistence.Parameter<Calendar> param,
                                                Calendar calendar,
                                                javax.persistence.TemporalType temporalType)
        指定者:
        setParameter 在接口中 javax.persistence.Query
        指定者:
        setParameter 在接口中 Query<X>
        指定者:
        setParameter 在接口中 Query<X>
        指定者:
        setParameter 在接口中 javax.persistence.TypedQuery<X>
      • setParameter

        public QueryImplementor<X> setParameter​(javax.persistence.Parameter<Date> param,
                                                Date date,
                                                javax.persistence.TemporalType temporalType)
        指定者:
        setParameter 在接口中 javax.persistence.Query
        指定者:
        setParameter 在接口中 Query<X>
        指定者:
        setParameter 在接口中 Query<X>
        指定者:
        setParameter 在接口中 javax.persistence.TypedQuery<X>
      • unwrap

        public <T> T unwrap​(Class<T> cls)
        指定者:
        unwrap 在接口中 javax.persistence.Query
      • getParameterValue

        public Object getParameterValue​(String name)
        指定者:
        getParameterValue 在接口中 javax.persistence.Query
      • getParameter

        public javax.persistence.Parameter<?> getParameter​(String name)
        指定者:
        getParameter 在接口中 javax.persistence.Query
      • getParameter

        public <T> javax.persistence.Parameter<T> getParameter​(String name,
                                                               Class<T> type)
        指定者:
        getParameter 在接口中 javax.persistence.Query
      • setParameter

        public QueryImplementor<X> setParameter​(String name,
                                                Object value)
        从接口复制的说明: Query
        Bind a named query parameter using its inferred Type. If the parameter is defined in such a way that the Type cannot be inferred from its usage context then use of this form of binding is not allowed, and Query.setParameter(String, Object, Type) should be used instead
        指定者:
        setParameter 在接口中 javax.persistence.Query
        指定者:
        setParameter 在接口中 Query<X>
        指定者:
        setParameter 在接口中 Query<X>
        指定者:
        setParameter 在接口中 javax.persistence.TypedQuery<X>
        参数:
        name - the parameter name
        value - the (possibly-null) parameter value
        返回:
        this, for method chaining
      • setParameter

        public QueryImplementor<X> setParameter​(String name,
                                                Calendar calendar,
                                                javax.persistence.TemporalType temporalType)
        指定者:
        setParameter 在接口中 javax.persistence.Query
        指定者:
        setParameter 在接口中 Query<X>
        指定者:
        setParameter 在接口中 Query<X>
        指定者:
        setParameter 在接口中 javax.persistence.TypedQuery<X>
      • setParameter

        public QueryImplementor<X> setParameter​(String name,
                                                Date date,
                                                javax.persistence.TemporalType temporalType)
        指定者:
        setParameter 在接口中 javax.persistence.Query
        指定者:
        setParameter 在接口中 Query<X>
        指定者:
        setParameter 在接口中 Query<X>
        指定者:
        setParameter 在接口中 javax.persistence.TypedQuery<X>
      • setParameter

        public QueryImplementor<X> setParameter​(String name,
                                                Object val,
                                                Type type)
        从接口复制的说明: Query
        Bind a named query parameter using the supplied Type
        指定者:
        setParameter 在接口中 Query<X>
        指定者:
        setParameter 在接口中 Query<X>
        参数:
        name - the name of the parameter
        val - the possibly-null parameter value
        type - the Hibernate type
        返回:
        this, for method chaining
      • setParameter

        public <T> QueryImplementor<X> setParameter​(QueryParameter<T> parameter,
                                                    T val)
        从接口复制的说明: Query
        Bind a query parameter using its inferred Type. If the parameter is defined in such a way that the Type cannot be inferred from its usage context then use of this form of binding is not allowed, and Query.setParameter(QueryParameter, Object, Type) should be used instead
        指定者:
        setParameter 在接口中 Query<X>
        指定者:
        setParameter 在接口中 Query<X>
        参数:
        parameter - The query parameter memento
        val - the possibly-null parameter value
        返回:
        this, for method chaining
      • setParameter

        public <P> QueryImplementor<X> setParameter​(QueryParameter<P> parameter,
                                                    P val,
                                                    javax.persistence.TemporalType temporalType)
        从接口复制的说明: Query
        Bind a query parameter as some form of date/time using the indicated temporal-type.
        指定者:
        setParameter 在接口中 Query<X>
        指定者:
        setParameter 在接口中 Query<X>
        参数:
        parameter - The query parameter memento
        val - the possibly-null parameter value
        temporalType - the temporal-type to use in binding the date/time
        返回:
        this, for method chaining
      • setParameter

        public <P> QueryImplementor<X> setParameter​(String name,
                                                    P val,
                                                    javax.persistence.TemporalType temporalType)
        从接口复制的说明: Query
        Bind a named query parameter as some form of date/time using the indicated temporal-type.
        指定者:
        setParameter 在接口中 Query<X>
        指定者:
        setParameter 在接口中 Query<X>
        参数:
        name - the parameter name
        val - the possibly-null parameter value
        temporalType - the temporal-type to use in binding the date/time
        返回:
        this, for method chaining
      • setParameterList

        public <P> QueryImplementor<X> setParameterList​(QueryParameter<P> parameter,
                                                        Collection<P> values)
        从接口复制的说明: Query
        Bind multiple values to a query parameter using its inferred Type. The Hibernate type of the parameter values is first detected via the usage/position in the query and if not sufficient secondly guessed from the class of the first object in the collection. This is useful for binding a list of values to an expression such as foo.bar in (:value_list).
        指定者:
        setParameterList 在接口中 Query<X>
        指定者:
        setParameterList 在接口中 Query<X>
        参数:
        parameter - the parameter memento
        values - a collection of values to list
        返回:
        this, for method chaining
      • setParameterList

        public QueryImplementor<X> setParameterList​(String name,
                                                    Collection values)
        从接口复制的说明: Query
        Bind multiple values to a named query parameter. The Hibernate type of the parameter is first detected via the usage/position in the query and if not sufficient secondly guessed from the class of the first object in the collection. This is useful for binding a list of values to an expression such as foo.bar in (:value_list).
        指定者:
        setParameterList 在接口中 Query<X>
        指定者:
        setParameterList 在接口中 Query<X>
        参数:
        name - the name of the parameter
        values - a collection of values to list
        返回:
        this, for method chaining
      • setParameterList

        public QueryImplementor<X> setParameterList​(String name,
                                                    Collection values,
                                                    Type type)
        从接口复制的说明: Query
        Bind multiple values to a named query parameter. This is useful for binding a list of values to an expression such as foo.bar in (:value_list).
        指定者:
        setParameterList 在接口中 Query<X>
        指定者:
        setParameterList 在接口中 Query<X>
        参数:
        name - the name of the parameter
        values - a collection of values to list
        type - the Hibernate type of the values
        返回:
        this, for method chaining
      • setParameterList

        public QueryImplementor<X> setParameterList​(String name,
                                                    Object[] values,
                                                    Type type)
        从接口复制的说明: Query
        Bind multiple values to a named query parameter. This is useful for binding a list of values to an expression such as foo.bar in (:value_list).
        指定者:
        setParameterList 在接口中 Query<X>
        指定者:
        setParameterList 在接口中 Query<X>
        参数:
        name - the name of the parameter
        values - a collection of values to list
        type - the Hibernate type of the values
        返回:
        this, for method chaining
      • setParameterList

        public QueryImplementor<X> setParameterList​(String name,
                                                    Object[] values)
        从接口复制的说明: Query
        Bind multiple values to a named query parameter. The Hibernate type of the parameter is first detected via the usage/position in the query and if not sufficient secondly guessed from the class of the first object in the array. This is useful for binding a list of values to an expression such as foo.bar in (:value_list).
        指定者:
        setParameterList 在接口中 Query<X>
        指定者:
        setParameterList 在接口中 Query<X>
        参数:
        name - the name of the parameter
        values - a collection of values to list
        返回:
        this, for method chaining
      • setParameter

        public <P> QueryImplementor<X> setParameter​(QueryParameter<P> parameter,
                                                    P value,
                                                    Type type)
        从接口复制的说明: Query
        Bind a query parameter using the supplied Type
        指定者:
        setParameter 在接口中 Query<X>
        指定者:
        setParameter 在接口中 Query<X>
        参数:
        parameter - The query parameter memento
        value - the possibly-null parameter value
        type - the Hibernate type
        返回:
        this, for method chaining
      • setProperties

        public QueryImplementor<X> setProperties​(Object bean)
        从接口复制的说明: Query
        Bind the property values of the given bean to named parameters of the query, matching property names with parameter names and mapping property types to Hibernate types using heuristics.
        指定者:
        setProperties 在接口中 Query<X>
        指定者:
        setProperties 在接口中 Query<X>
        参数:
        bean - any JavaBean or POJO
        返回:
        this, for method chaining
      • setProperties

        public QueryImplementor setProperties​(Map map)
        从接口复制的说明: Query
        Bind the values of the given Map for each named parameters of the query, matching key names with parameter names and mapping value types to Hibernate types using heuristics.
        指定者:
        setProperties 在接口中 Query<X>
        指定者:
        setProperties 在接口中 Query<X>
        参数:
        map - a java.util.Map
        返回:
        this, for method chaining
      • setParameter

        public QueryImplementor<X> setParameter​(int position,
                                                Object val,
                                                Type type)
        从接口复制的说明: Query
        Bind a value to a JDBC-style query parameter.
        指定者:
        setParameter 在接口中 Query<X>
        指定者:
        setParameter 在接口中 Query<X>
        参数:
        position - the position of the parameter in the query string, numbered from 0.
        val - the possibly-null parameter value
        type - the Hibernate type
        返回:
        this, for method chaining
      • setEntity

        public QueryImplementor<X> setEntity​(int position,
                                             Object val)
        从接口复制的说明: Query
        Bind an instance of a mapped persistent class to a JDBC-style query parameter. Use Query.setParameter(int, Object) for null values.
        指定者:
        setEntity 在接口中 Query<X>
        指定者:
        setEntity 在接口中 Query<X>
        参数:
        position - the position of the parameter in the query string, numbered from 0.
        val - a non-null instance of a persistent class
        返回:
        this, for method chaining
      • setParameter

        public <P> QueryImplementor<X> setParameter​(int position,
                                                    P val,
                                                    javax.persistence.TemporalType temporalType)
        从接口复制的说明: Query
        Bind a positional query parameter as some form of date/time using the indicated temporal-type.
        指定者:
        setParameter 在接口中 Query<X>
        指定者:
        setParameter 在接口中 Query<X>
        参数:
        position - the position of the parameter in the query string, numbered from 0.
        val - the possibly-null parameter value
        temporalType - the temporal-type to use in binding the date/time
        返回:
        this, for method chaining
      • executeUpdate

        public int executeUpdate()
        指定者:
        executeUpdate 在接口中 javax.persistence.Query
      • setParameter

        public QueryImplementor<X> setParameter​(int i,
                                                Object o)
        从接口复制的说明: Query
        Bind a positional query parameter using its inferred Type. If the parameter is defined in such a way that the Type cannot be inferred from its usage context then use of this form of binding is not allowed, and Query.setParameter(int, Object, Type) should be used instead
        指定者:
        setParameter 在接口中 javax.persistence.Query
        指定者:
        setParameter 在接口中 Query<X>
        指定者:
        setParameter 在接口中 Query<X>
        指定者:
        setParameter 在接口中 javax.persistence.TypedQuery<X>
        参数:
        i - the position of the parameter in the query string, numbered from 0.
        o - the possibly-null parameter value
        返回:
        this, for method chaining
      • setParameter

        public QueryImplementor<X> setParameter​(int i,
                                                Calendar calendar,
                                                javax.persistence.TemporalType temporalType)
        指定者:
        setParameter 在接口中 javax.persistence.Query
        指定者:
        setParameter 在接口中 Query<X>
        指定者:
        setParameter 在接口中 Query<X>
        指定者:
        setParameter 在接口中 javax.persistence.TypedQuery<X>
      • setParameter

        public QueryImplementor<X> setParameter​(int i,
                                                Date date,
                                                javax.persistence.TemporalType temporalType)
        指定者:
        setParameter 在接口中 javax.persistence.Query
        指定者:
        setParameter 在接口中 Query<X>
        指定者:
        setParameter 在接口中 Query<X>
        指定者:
        setParameter 在接口中 javax.persistence.TypedQuery<X>
      • getParameterValue

        public Object getParameterValue​(int position)
        指定者:
        getParameterValue 在接口中 javax.persistence.Query
      • getParameter

        public javax.persistence.Parameter<?> getParameter​(int position)
        指定者:
        getParameter 在接口中 javax.persistence.Query
      • getParameter

        public <T> javax.persistence.Parameter<T> getParameter​(int position,
                                                               Class<T> type)
        指定者:
        getParameter 在接口中 javax.persistence.Query