Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne.query
Class NamedQuery

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

All Implemented Interfaces:
  java.io.Serializable, Query

    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
Author:
  Andrus Adamchik
See Also:
  Serialized Form

Field Summary
`protected boolean` | `forceNoCache`
`protected org.apache.cayenne.query.BaseQueryMetadata` | `overrideMetadata`
`protected java.util.Map` | `parameters`

Fields inherited from class org.apache.cayenne.query.IndirectQuery
`lastResolver, name, replacementQuery`

Constructor Summary
`NamedQuery(java.lang.String name)`
`NamedQuery(java.lang.String name, java.util.Map parameters)`
`NamedQuery(java.lang.String name, java.lang.String[] keys, java.lang.Object[] values)` Creates NamedQuery with parameters passed as two matching arrays of keys and values.

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

Methods inherited from class org.apache.cayenne.query.IndirectQuery
`createSQLAction, getName, getReplacementQuery, getRoot, route, setName, setRoot`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### parameters

    protected java.util.Map parameters

### forceNoCache

    protected boolean forceNoCache

### overrideMetadata

    protected org.apache.cayenne.query.BaseQueryMetadata overrideMetadata

Constructor Detail

### NamedQuery

    public NamedQuery(java.lang.String name)

### NamedQuery

    public NamedQuery(java.lang.String name,
                      java.util.Map parameters)

### NamedQuery

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

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

Method Detail

### getMetaData

    public QueryMetadata getMetaData(EntityResolver resolver)

  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)

  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)

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

### toString

    public java.lang.String toString()

  Overrides toString() outputting a short string with query class and name.

  Overrides:
    `toString` in class `java.lang.Object`

### initMetadata

    public void initMetadata(QueryMetadata metadata)

  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(java.lang.Object object)

  An object is considered equal to this NamedQuery if it is a NamedQuery with the same queryName and same parameters.

  Overrides:
    `equals` in class `java.lang.Object`

### hashCode

    public int hashCode()

  Implements a standard hashCode contract considering custom 'equals' implementation.

  Overrides:
    `hashCode` in class `java.lang.Object`

### isForceNoCache

    public boolean isForceNoCache()

### setForceNoCache

    public void setForceNoCache(boolean forcingNoCache)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2006 Apache.org All Rights Reserved.