RefreshQuery (cayenne-doc: Cayenne Documentation 5.0-M2 API)
Description: declaration: package: org.apache.cayenne.query, class: RefreshQuery

# Class RefreshQuery

java.lang.Object
org.apache.cayenne.query.RefreshQuery

All Implemented Interfaces:
  `Serializable, Query`

public class RefreshQuery extends Object implements Query
A query that allows to explicitly clear both object and list caches either via refetch (eager refresh) or invalidate (lazy refresh).

Since:
  3.0
See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected String[]`
  `groupKeys`
  `protected Collection<?>`
  `objects`
  `protected Query`
  `query`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `RefreshQuery()`
  Deprecated.
  since 4.0, "refresh all" query will drop all cache contents
  `RefreshQuery(String... groupKeys)`
  Creates a RefreshQuery that refreshes query results identified by group keys.
  `RefreshQuery(Collection<?> objects)`
  Creates a RefreshQuery that refreshes a collection of objects, including invalidation of their relationships.
  `RefreshQuery(Persistent object)`
  Creates a RefreshQuery that refreshes a single object, including invalidation of its relationships.
  `RefreshQuery(Query query)`
  Creates a RefreshQuery that refreshes results of a query and individual objects in the result.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `SQLAction`
  `createSQLAction(SQLActionVisitor visitor)`
  A callback method invoked by Cayenne during the final execution phase of the query run.
  `String[]`
  `getGroupKeys()`
  `QueryMetadata`
  `getMetaData(EntityResolver resolver)`
  Returns query runtime parameters.
  `Collection<?>`
  `getObjects()`
  `Query`
  `getQuery()`
  Returns an internal query, overriding cache policy to force a refresh.
  `boolean`
  `isRefreshAll()`
  `void`
  `route(QueryRouter router, EntityResolver resolver, Query substitutedQuery)`
  A callback method invoked by Cayenne during the routing phase of the query execution.

  ### Methods inherited from class Object

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

- ## Field Details

  - ### objects

    protected Collection<?> objects

  - ### query

    protected Query query

  - ### groupKeys

    protected String[] groupKeys

- ## Constructor Details

  - ### RefreshQuery

    @Deprecated public RefreshQuery()
    Deprecated.
    since 4.0, "refresh all" query will drop all cache contents
    Creates a RefreshQuery that does full refresh of all registered objects, cascading refresh all the way to the shared cache.
    See Also:
      - `QueryCache.clear()`

  - ### RefreshQuery

    public RefreshQuery(Collection<?> objects)
    Creates a RefreshQuery that refreshes a collection of objects, including invalidation of their relationships.

  - ### RefreshQuery

    public RefreshQuery(Persistent object)
    Creates a RefreshQuery that refreshes a single object, including invalidation of its relationships.

  - ### RefreshQuery

    public RefreshQuery(Query query)
    Creates a RefreshQuery that refreshes results of a query and individual objects in the result.

  - ### RefreshQuery

    public RefreshQuery(String... groupKeys)
    Creates a RefreshQuery that refreshes query results identified by group keys.

- ## Method Details

  - ### getMetaData

    public QueryMetadata getMetaData(EntityResolver resolver)
    Description copied from interface: `Query`
    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.
    Specified by:
      `getMetaData` in interface `Query`

  - ### route

    public void route(QueryRouter router, EntityResolver resolver, Query substitutedQuery)
    Description copied from interface: `Query`
    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(DataNode, Query, Query)` callback method to route itself. Query can create one or more substitute queries or even provide its own DataNode to execute itself.
    Specified by:
      `route` in interface `Query`

  - ### createSQLAction

    public 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.
    Specified by:
      `createSQLAction` in interface `Query`

  - ### isRefreshAll

    public boolean isRefreshAll()

  - ### getGroupKeys

    public String[] getGroupKeys()

  - ### getObjects

    public Collection<?> getObjects()

  - ### getQuery

    public Query getQuery()
    Returns an internal query, overriding cache policy to force a refresh. Returns null if no query was set.