org.apache.cayenne.query

## Interface Query

- All Superinterfaces:
    Serializable
  All Known Subinterfaces:
    ParameterizedQuery, Select<T>
  All Known Implementing Classes:
    AbstractMappedQuery, AbstractQuery, BatchQuery, CacheableQuery, ColumnSelect, DeleteBatchQuery, EJBQLQuery, FluentSelect, IndirectQuery, InsertBatchQuery, MappedExec, MappedSelect, NamedQuery, ObjectIdQuery, ObjectSelect, PrefetchSelectQuery, ProcedureCall, ProcedureQuery, QueryChain, RefreshQuery, RelationshipQuery, SelectById, SelectQuery, SQLExec, SQLSelect, SQLTemplate, UpdateBatchQuery

      public interface Query
      extends Serializable

  Defines minimal API of a query descriptor that is executable via Cayenne.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `SQLAction` | `createSQLAction(SQLActionVisitor visitor)` A callback method invoked by Cayenne during the final execution phase of the query run.
    `DataMap` | `getDataMap()` Deprecated. since 4.0, `QueryDescriptor.getDataMap()` should be used instead
    `QueryMetadata` | `getMetaData(EntityResolver resolver)` Returns query runtime parameters.
    `String` | `getName()` Deprecated. `QueryDescriptor.getName()` should be used instead
    `void` | `route(QueryRouter router, EntityResolver resolver, Query substitutedQuery)` A callback method invoked by Cayenne during the routing phase of the query execution.

- - ### Method Detail

    - #### getMetaData

          QueryMetadata getMetaData(EntityResolver resolver)

      Returns query runtime parameters. The method is called at various stages of the execution by Cayenne access stack to retrieve query parameters. EntityResolver instance is passed to this method, meaning that the query doesn't need to store direct references to Cayenne mapping objects and can resolve them at runtime.
      Since:
        1.2

    - #### route

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

      A callback method invoked by Cayenne during the routing phase of the query execution. Mapping of DataNodes is provided by QueryRouter. Query should use a `QueryRouter.route(QueryEngine, Query, Query)` callback method to route itself. Query can create one or more substitute queries or even provide its own QueryEngine to execute itself.
      Since:
        1.2

    - #### createSQLAction

          SQLAction createSQLAction(SQLActionVisitor visitor)

      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

    - #### getName

          @Deprecated
          String getName()

      Deprecated. `QueryDescriptor.getName()` should be used instead
      Returns a symbolic name of the query. The name is normally used as a key to find queries stored in the DataMap.
      Since:
        1.1

    - #### getDataMap

          @Deprecated
          DataMap getDataMap()

      Deprecated. since 4.0, `QueryDescriptor.getDataMap()` should be used instead
      Since:
        3.1

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