org.apache.cayenne.query

## Class AbstractQuery

- java.lang.Object
- - org.apache.cayenne.query.CacheableQuery
  - - org.apache.cayenne.query.AbstractQuery

- All Implemented Interfaces:
    Serializable, Query
  Direct Known Subclasses:
    ProcedureQuery, SelectQuery, SQLTemplate

      public abstract class AbstractQuery
      extends CacheableQuery

  A common superclass of Cayenne queries.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected DataMap` | `dataMap` Deprecated.
    `protected String` | `name` Deprecated.
    `protected Object` | `root` The root object this query.

    - ### Fields inherited from class org.apache.cayenne.query.CacheableQuery

      `logger`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractQuery()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract SQLAction` | `createSQLAction(SQLActionVisitor visitor)` A callback method invoked by Cayenne during the final execution phase of the query run.
    `DataMap` | `getDataMap()` Deprecated.
    `QueryMetadata` | `getMetaData(EntityResolver resolver)` Returns default select parameters.
    `String` | `getName()` Deprecated.
    `Object` | `getRoot()` Returns the root of this query.
    `void` | `route(QueryRouter router, EntityResolver resolver, Query substitutedQuery)` Implements default routing mechanism relying on the EntityResolver to find DataMap based on the query root.
    `void` | `setDataMap(DataMap dataMap)` Deprecated.
    `void` | `setName(String name)` Deprecated.
    `void` | `setRoot(Object value)` Sets the root of the query
    `String` | `toString()`

    - ### Methods inherited from class org.apache.cayenne.query.CacheableQuery

      `getBaseMetaData, getCacheGroup, getCacheGroups, getCacheStrategy, setCacheGroup, setCacheGroups, setCacheStrategy, useLocalCache, useLocalCache, useLocalCache, useSharedCache, useSharedCache, useSharedCache`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### root

          protected Object root

      The root object this query. May be an entity name, Java class, ObjEntity or DbEntity, depending on the specific query and how it was constructed.

    - #### name

          @Deprecated
          protected String name

      Deprecated.

    - #### dataMap

          @Deprecated
          protected DataMap dataMap

      Deprecated.

  - ### Constructor Detail

    - #### AbstractQuery

          public AbstractQuery()

  - ### Method Detail

    - #### getDataMap

          @Deprecated
          public DataMap getDataMap()

      Deprecated.
      Since:
        3.1

    - #### setDataMap

          @Deprecated
          public void setDataMap(DataMap dataMap)

      Deprecated.
      Since:
        3.1

    - #### getName

          @Deprecated
          public String getName()

      Deprecated.
      Returns a symbolic name of the query.
      Since:
        1.1

    - #### setName

          @Deprecated
          public void setName(String name)

      Deprecated.
      Sets a symbolic name of the query.
      Since:
        1.1

    - #### getMetaData

          public QueryMetadata getMetaData(EntityResolver resolver)

      Returns default select parameters.
      Since:
        1.2

    - #### getRoot

          public Object getRoot()

      Returns the root of this query.

    - #### setRoot

          public void setRoot(Object value)

      Sets the root of the query
      Parameters:
        `value` - The new root
      Throws:
        `IllegalArgumentException` - if value is not a String, ObjEntity, DbEntity, Procedure, DataMap, Class or null.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### createSQLAction

          public abstract SQLAction createSQLAction(SQLActionVisitor visitor)

      Description copied from interface: `Query`
      A callback method invoked by Cayenne during the final execution phase of the query run. A concrete query implementation is given a chance to decide how it should be handled. Implementors can pick an appropriate method of the SQLActionVisitor to handle itself, create a custom SQLAction of its own, or substitute itself with another query that should be used for SQLAction construction.
      Since:
        1.2

    - #### route

          public void route(QueryRouter router,
                            EntityResolver resolver,
                            Query substitutedQuery)

      Implements default routing mechanism relying on the EntityResolver to find DataMap based on the query root. This mechanism should be sufficient for most queries that "know" their root.
      Since:
        1.2

Copyright © 2001–2018 Apache Cayenne. All rights reserved.