Class QueryImpl<X>

java.lang.Object
org.apache.openjpa.persistence.AbstractQuery<X>
org.apache.openjpa.persistence.QueryImpl<X>
All Implemented Interfaces:
jakarta.persistence.Query, jakarta.persistence.TypedQuery<X>, Serializable, OpenJPAQuery<X>, OpenJPAQuerySPI<X>

public class QueryImpl<X> extends AbstractQuery<X> implements Serializable
Implementation of Query interface.
Author:
Marc Prud'hommeaux, Abe White
See Also:
  • Constructor Details

  • Method Details

    • getDelegate

      public Query getDelegate()
      Delegate.
    • getEntityManager

      public OpenJPAEntityManager getEntityManager()
      Description copied from interface: OpenJPAQuery
      The owning entity manager.
      Specified by:
      getEntityManager in interface OpenJPAQuery<X>
    • getLanguage

      public String getLanguage()
      Description copied from interface: OpenJPAQuery
      Query language.
      Specified by:
      getLanguage in interface OpenJPAQuery<X>
    • getOperation

      public QueryOperationType getOperation()
      Description copied from interface: OpenJPAQuery
      Query operation type.
      Specified by:
      getOperation in interface OpenJPAQuery<X>
    • getFetchPlan

      public FetchPlan getFetchPlan()
      Description copied from interface: OpenJPAQuery
      Fetch plan for controlling the loading of results.
      Specified by:
      getFetchPlan in interface OpenJPAQuery<X>
    • getQueryString

      public String getQueryString()
      Description copied from interface: OpenJPAQuery
      Query string.
      Specified by:
      getQueryString in interface OpenJPAQuery<X>
    • getIgnoreChanges

      public boolean getIgnoreChanges()
      Description copied from interface: OpenJPAQuery
      Whether to ignore changes in the current transaction.
      Specified by:
      getIgnoreChanges in interface OpenJPAQuery<X>
    • setIgnoreChanges

      public OpenJPAQuery<X> setIgnoreChanges(boolean ignore)
      Description copied from interface: OpenJPAQuery
      Whether to ignore changes in the current transaction.
      Specified by:
      setIgnoreChanges in interface OpenJPAQuery<X>
    • addFilterListener

      public OpenJPAQuery<X> addFilterListener(FilterListener listener)
      Description copied from interface: OpenJPAQuerySPI
      Register a filter listener for the query.
      Specified by:
      addFilterListener in interface OpenJPAQuery<X>
      Specified by:
      addFilterListener in interface OpenJPAQuerySPI<X>
    • removeFilterListener

      public OpenJPAQuery<X> removeFilterListener(FilterListener listener)
      Description copied from interface: OpenJPAQuerySPI
      Remove a filter listener from the query.
      Specified by:
      removeFilterListener in interface OpenJPAQuery<X>
      Specified by:
      removeFilterListener in interface OpenJPAQuerySPI<X>
    • addAggregateListener

      public OpenJPAQuery<X> addAggregateListener(AggregateListener listener)
      Description copied from interface: OpenJPAQuerySPI
      Register an aggregate listener for the query.
      Specified by:
      addAggregateListener in interface OpenJPAQuery<X>
      Specified by:
      addAggregateListener in interface OpenJPAQuerySPI<X>
    • removeAggregateListener

      public OpenJPAQuery<X> removeAggregateListener(AggregateListener listener)
      Description copied from interface: OpenJPAQuerySPI
      Remove an aggregate listener from the query.
      Specified by:
      removeAggregateListener in interface OpenJPAQuery<X>
      Specified by:
      removeAggregateListener in interface OpenJPAQuerySPI<X>
    • getCandidateCollection

      public Collection<?> getCandidateCollection()
      Description copied from interface: OpenJPAQuery
      Return the candidate collection, or null if an extent was specified instead of a collection.
      Specified by:
      getCandidateCollection in interface OpenJPAQuery<X>
    • setCandidateCollection

      public OpenJPAQuery<X> setCandidateCollection(Collection coll)
      Description copied from interface: OpenJPAQuery
      Set a collection of candidates.
      Specified by:
      setCandidateCollection in interface OpenJPAQuery<X>
    • getResultClass

      public Class getResultClass()
      Description copied from interface: OpenJPAQuery
      Query result element type.
      Specified by:
      getResultClass in interface OpenJPAQuery<X>
    • setResultClass

      public OpenJPAQuery<X> setResultClass(Class cls)
      Description copied from interface: OpenJPAQuery
      Query result element type.
      Specified by:
      setResultClass in interface OpenJPAQuery<X>
    • hasSubclasses

      public boolean hasSubclasses()
      Description copied from interface: OpenJPAQuery
      Whether subclasses are included in the query results.
      Specified by:
      hasSubclasses in interface OpenJPAQuery<X>
    • setSubclasses

      public OpenJPAQuery<X> setSubclasses(boolean subs)
      Description copied from interface: OpenJPAQuery
      Whether subclasses are included in the query results.
      Specified by:
      setSubclasses in interface OpenJPAQuery<X>
    • getFirstResult

      public int getFirstResult()
      Description copied from interface: OpenJPAQuery
      Return the 0-based start index for the returned results.
      Specified by:
      getFirstResult in interface OpenJPAQuery<X>
      Specified by:
      getFirstResult in interface jakarta.persistence.Query
    • setFirstResult

      public OpenJPAQuery<X> setFirstResult(int startPosition)
      Specified by:
      setFirstResult in interface OpenJPAQuery<X>
      Specified by:
      setFirstResult in interface jakarta.persistence.Query
      Specified by:
      setFirstResult in interface jakarta.persistence.TypedQuery<X>
    • getMaxResults

      public int getMaxResults()
      Description copied from interface: OpenJPAQuery
      Return the maximum number of results to retrieve. or Integer.MAX_VALUE for no limit.
      Specified by:
      getMaxResults in interface OpenJPAQuery<X>
      Specified by:
      getMaxResults in interface jakarta.persistence.Query
    • setMaxResults

      public OpenJPAQuery<X> setMaxResults(int max)
      Specified by:
      setMaxResults in interface OpenJPAQuery<X>
      Specified by:
      setMaxResults in interface jakarta.persistence.Query
      Specified by:
      setMaxResults in interface jakarta.persistence.TypedQuery<X>
    • compile

      public OpenJPAQuery<X> compile()
      Description copied from interface: OpenJPAQuery
      Compile the query.
      Specified by:
      compile in interface OpenJPAQuery<X>
    • getResultList

      public List getResultList()
      Specified by:
      getResultList in interface jakarta.persistence.Query
      Specified by:
      getResultList in interface jakarta.persistence.TypedQuery<X>
    • getSingleResult

      public X getSingleResult()
      Execute a query that returns a single result.
      Specified by:
      getSingleResult in interface jakarta.persistence.Query
      Specified by:
      getSingleResult in interface jakarta.persistence.TypedQuery<X>
    • executeUpdate

      public int executeUpdate()
      Specified by:
      executeUpdate in interface jakarta.persistence.Query
    • getFlushMode

      public jakarta.persistence.FlushModeType getFlushMode()
      Description copied from interface: OpenJPAQuery
      Return the current flush mode.
      Specified by:
      getFlushMode in interface OpenJPAQuery<X>
      Specified by:
      getFlushMode in interface jakarta.persistence.Query
    • setFlushMode

      public OpenJPAQuery<X> setFlushMode(jakarta.persistence.FlushModeType flushMode)
      Specified by:
      setFlushMode in interface OpenJPAQuery<X>
      Specified by:
      setFlushMode in interface jakarta.persistence.Query
      Specified by:
      setFlushMode in interface jakarta.persistence.TypedQuery<X>
    • closeAll

      public OpenJPAQuery<X> closeAll()
      Description copied from interface: OpenJPAQuery
      Close all open query results.
      Specified by:
      closeAll in interface OpenJPAQuery<X>
    • getDataStoreActions

      public String[] getDataStoreActions(Map params)
      Description copied from interface: OpenJPAQuery
      Returns a description of the commands that will be sent to the datastore in order to execute this query. This will typically be in the native query language of the database (e.g., SQL).
      Specified by:
      getDataStoreActions in interface OpenJPAQuery<X>
      Parameters:
      params - the named parameter map for the query invocation
    • getLockMode

      public jakarta.persistence.LockModeType getLockMode()
      Specified by:
      getLockMode in interface jakarta.persistence.Query
    • setLockMode

      public jakarta.persistence.TypedQuery<X> setLockMode(jakarta.persistence.LockModeType lockMode)
      Sets lock mode on the given query. If the target query has been prepared and cached, then ignores the cached version.
      Specified by:
      setLockMode in interface jakarta.persistence.Query
      Specified by:
      setLockMode in interface jakarta.persistence.TypedQuery<X>
      See Also:
      • ignorePreparedQuery()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • getHints

      public Map<String,Object> getHints()
      Get all the active hints and their values.
      Specified by:
      getHints in interface jakarta.persistence.Query
    • setHint

      public OpenJPAQuery<X> setHint(String key, Object value)
      Specified by:
      setHint in interface OpenJPAQuery<X>
      Specified by:
      setHint in interface jakarta.persistence.Query
      Specified by:
      setHint in interface jakarta.persistence.TypedQuery<X>
    • getSupportedHints

      public Set<String> getSupportedHints()
      Description copied from interface: OpenJPAQuery
      Gets hints supported by this query.
      Specified by:
      getSupportedHints in interface OpenJPAQuery<X>
    • unwrap

      public <T> T unwrap(Class<T> cls)
      Unwraps this receiver to an instance of the given class, if possible.
      Specified by:
      unwrap in interface jakarta.persistence.Query
      Since:
      2.0.0
    • lock

      protected void lock()
      Specified by:
      lock in class AbstractQuery<X>
    • unlock

      protected void unlock()
      Specified by:
      unlock in class AbstractQuery<X>
    • assertOpen

      protected void assertOpen()
      Specified by:
      assertOpen in class AbstractQuery<X>
    • getParamTypes

      public OrderedMap<Object,Class<?>> getParamTypes()
      Specified by:
      getParamTypes in class AbstractQuery<X>
      Returns:
      a map of parameter name to type for this query.
    • toString

      public String toString()
      Overrides:
      toString in class Object