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 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(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.
      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.