Class HQLQueryPlan

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    FilterQueryPlan

    public class HQLQueryPlan
    extends java.lang.Object
    implements java.io.Serializable
    Defines a query execution plan for an HQL query (or filter).
    See Also:
    Serialized Form
    • Constructor Detail

      • HQLQueryPlan

        public HQLQueryPlan​(java.lang.String hql,
                            boolean shallow,
                            java.util.Map<java.lang.String,​Filter> enabledFilters,
                            SessionFactoryImplementor factory)
        Constructs a HQLQueryPlan
        Parameters:
        hql - The HQL query
        shallow - Whether the execution is to be shallow or not
        enabledFilters - The enabled filters (we only keep the names)
        factory - The factory
      • HQLQueryPlan

        protected HQLQueryPlan​(java.lang.String hql,
                               java.lang.String collectionRole,
                               boolean shallow,
                               java.util.Map<java.lang.String,​Filter> enabledFilters,
                               SessionFactoryImplementor factory,
                               EntityGraphQueryHint entityGraphQueryHint)
    • Method Detail

      • getSourceQuery

        public java.lang.String getSourceQuery()
      • getQuerySpaces

        public java.util.Set getQuerySpaces()
      • getParameterMetadata

        public org.hibernate.query.internal.ParameterMetadataImpl getParameterMetadata()
      • getEnabledFilterNames

        public java.util.Set getEnabledFilterNames()
      • getSqlStrings

        public java.lang.String[] getSqlStrings()
        This method should only be called for debugging purposes as it regenerates a new array every time.
      • getUtilizedFilterNames

        public java.util.Set getUtilizedFilterNames()
      • isShallow

        public boolean isShallow()
      • guessResultSize

        protected int guessResultSize​(RowSelection rowSelection)
        If we're able to guess a likely size of the results we can optimize allocation of our data structures. Essentially if we detect the user is not using pagination, we attempt to use the FetchSize as a reasonable hint. If fetch size is not being set either, it is reasonable to expect that we're going to have a single hit. In such a case it would be tempting to return a constant of value one, but that's dangerous as it doesn't scale up appropriately for example with an ArrayList if the guess is wrong.
        Parameters:
        rowSelection -
        Returns:
        a reasonable size to use for allocation
      • performIterate

        public java.util.Iterator performIterate​(QueryParameters queryParameters,
                                                 EventSource session)
                                          throws HibernateException
        Coordinates the efforts to perform an iterate across all the included query translators.
        Parameters:
        queryParameters - The query parameters
        session - The session
        Returns:
        The query result iterator
        Throws:
        HibernateException - Indicates a problem performing the query
      • performExecuteUpdate

        public int performExecuteUpdate​(QueryParameters queryParameters,
                                        SharedSessionContractImplementor session)
                                 throws HibernateException
        Coordinates the efforts to perform an execution across all the included query translators.
        Parameters:
        queryParameters - The query parameters
        session - The session
        Returns:
        The aggregated "affected row" count
        Throws:
        HibernateException - Indicates a problem performing the execution
      • getTranslators

        public QueryTranslator[] getTranslators()
        Access to the underlying translators associated with this query
        Returns:
        The translators
      • getDynamicInstantiationResultType

        public java.lang.Class getDynamicInstantiationResultType()
      • isSelect

        public boolean isSelect()
      • isUpdate

        public boolean isUpdate()