org.apache.cayenne.query

## Class NamedQuery

- java.lang.Object
- - org.apache.cayenne.query.IndirectQuery
  - - org.apache.cayenne.query.NamedQuery

- All Implemented Interfaces:
    Serializable, Query

  Deprecated.
  since 4.0 you should use `MappedSelect` or `MappedExec` instead.

      @Deprecated
      public class NamedQuery
      extends IndirectQuery

  A query that is a reference to a named parameterized query stored in the mapping. The actual query is resolved during execution.
  Since:
    1.2
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `forceNoCache` Deprecated.
    `protected org.apache.cayenne.query.BaseQueryMetadata` | `overrideMetadata` Deprecated.
    `protected Map<String,Object>` | `parameters` Deprecated.

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

      `dataMap, lastResolver, name, replacementQuery`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `NamedQuery(String name)` Deprecated.
    `NamedQuery(String name, Map<String,?> parameters)` Deprecated.
    `NamedQuery(String name, String[] keys, Object[] values)` Deprecated. Creates NamedQuery with parameters passed as two matching arrays of keys and values.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Query` | `createReplacementQuery(EntityResolver resolver)` Deprecated. Creates a substitute query.
    `boolean` | `equals(Object object)` Deprecated. An object is considered equal to this NamedQuery if it is a NamedQuery with the same queryName and same parameters.
    `QueryMetadata` | `getMetaData(EntityResolver resolver)` Deprecated. Returns the metadata obtained from the replacement query.
    `int` | `hashCode()` Deprecated. Implements a standard hashCode contract considering custom 'equals' implementation.
    `void` | `initMetadata(QueryMetadata metadata)` Deprecated. Initializes metadata overrides.
    `boolean` | `isForceNoCache()` Deprecated.
    `protected Query` | `resolveQuery(EntityResolver resolver)` Deprecated. Returns a query for name, throwing an exception if such query is not mapped in the EntityResolver.
    `void` | `setForceNoCache(boolean forcingNoCache)` Deprecated.
    `String` | `toString()` Deprecated. Overrides toString() outputting a short string with query class and name.

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

      `createSQLAction, getDataMap, getName, getReplacementQuery, route, setDataMap, setName`

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

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

- - ### Field Detail

    - #### parameters

          protected Map<String,Object> parameters

      Deprecated.

    - #### forceNoCache

          protected boolean forceNoCache

      Deprecated.

    - #### overrideMetadata

          protected org.apache.cayenne.query.BaseQueryMetadata overrideMetadata

      Deprecated.

  - ### Constructor Detail

    - #### NamedQuery

          public NamedQuery(String name)

      Deprecated.

    - #### NamedQuery

          public NamedQuery(String name,
                            Map<String,?> parameters)

      Deprecated.

    - #### NamedQuery

          public NamedQuery(String name,
                            String[] keys,
                            Object[] values)

      Deprecated.
      Creates NamedQuery with parameters passed as two matching arrays of keys and values.

  - ### Method Detail

    - #### getMetaData

          public QueryMetadata getMetaData(EntityResolver resolver)

      Deprecated.
      Description copied from class: `IndirectQuery`
      Returns the metadata obtained from the replacement query.
      Specified by:
        `getMetaData` in interface `Query`
      Overrides:
        `getMetaData` in class `IndirectQuery`

    - #### createReplacementQuery

          protected Query createReplacementQuery(EntityResolver resolver)

      Deprecated.
      Description copied from class: `IndirectQuery`
      Creates a substitute query. An implementor is free to provide an arbitrary replacement query.
      Specified by:
        `createReplacementQuery` in class `IndirectQuery`

    - #### resolveQuery

          protected Query resolveQuery(EntityResolver resolver)

      Deprecated.
      Returns a query for name, throwing an exception if such query is not mapped in the EntityResolver.

    - #### toString

          public String toString()

      Deprecated.
      Overrides toString() outputting a short string with query class and name.
      Overrides:
        `toString` in class `Object`

    - #### initMetadata

          public void initMetadata(QueryMetadata metadata)

      Deprecated.
      Initializes metadata overrides. Needed to store the metadata for the remote query proxies that have no access to the actual query.

    - #### equals

          public boolean equals(Object object)

      Deprecated.
      An object is considered equal to this NamedQuery if it is a NamedQuery with the same queryName and same parameters.
      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Deprecated.
      Implements a standard hashCode contract considering custom 'equals' implementation.
      Overrides:
        `hashCode` in class `Object`

    - #### isForceNoCache

          public boolean isForceNoCache()

      Deprecated.

    - #### setForceNoCache

          public void setForceNoCache(boolean forcingNoCache)

      Deprecated.

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