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 ObjectIdQuery

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

All Implemented Interfaces:
  java.io.Serializable, Query

    public class ObjectIdQuery

extends IndirectQuery

A query that matches zero or one object or data row corresponding to the ObjectId. Used internally by Cayenne to lookup objects by id. Notice that cache policies of ObjectIdQuery are different from generic `QueryMetadata` cache policies. ObjectIdQuery is special - it is the only query that can be done against Cayenne main cache, thus cache handling is singnificantly different from all other of the queries.

Since:
  1.2
Author:
  Andrus Adamchik
See Also:
  Serialized Form

Field Summary
`static int` | `CACHE`
`static int` | `CACHE_NOREFRESH`
`static int` | `CACHE_REFRESH`
`protected int` | `cachePolicy`
`protected boolean` | `fetchingDataRows`
`protected QueryMetadata` | `metadata`
`protected EntityResolver` | `metadataResolver`
`protected ObjectId` | `objectId`

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

Constructor Summary
`ObjectIdQuery(ObjectId objectID)` Creates a refreshing SingleObjectQuery.
`ObjectIdQuery(ObjectId objectId, boolean fetchingDataRows, int cachePolicy)` Creates a new ObjectIdQuery.

Method Summary
`protected Query` | `createReplacementQuery(EntityResolver resolver)` Creates a substitute query.
`boolean` | `equals(java.lang.Object object)` An object is considered equal to this query if it is also a SingleObjectQuery with an equal ObjectId.
`int` | `getCachePolicy()`
`QueryMetadata` | `getMetaData(EntityResolver resolver)` Returns query metadata object.
`ObjectId` | `getObjectId()`
`java.lang.Object` | `getRoot()` Deprecated. since 1.2
`int` | `hashCode()` Implements a standard hashCode contract considering custom 'equals' implementation.
`boolean` | `isFetchAllowed()`
`boolean` | `isFetchingDataRows()`
`boolean` | `isFetchMandatory()`
`java.lang.String` | `toString()` Overrides toString() outputting a short string with query class and ObjectId.

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

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

Field Detail

### CACHE

    public static final int CACHE

See Also:
  Constant Field Values

### CACHE_REFRESH

    public static final int CACHE_REFRESH

See Also:
  Constant Field Values

### CACHE_NOREFRESH

    public static final int CACHE_NOREFRESH

See Also:
  Constant Field Values

### objectId

    protected ObjectId objectId

### cachePolicy

    protected int cachePolicy

### fetchingDataRows

    protected boolean fetchingDataRows

### metadataResolver

    protected transient EntityResolver metadataResolver

### metadata

    protected transient QueryMetadata metadata

Constructor Detail

### ObjectIdQuery

    public ObjectIdQuery(ObjectId objectID)

  Creates a refreshing SingleObjectQuery.

### ObjectIdQuery

    public ObjectIdQuery(ObjectId objectId,
                         boolean fetchingDataRows,
                         int cachePolicy)

  Creates a new ObjectIdQuery.

Method Detail

### getMetaData

    public QueryMetadata getMetaData(EntityResolver resolver)

  Returns query metadata object.

  Specified by:
    `getMetaData` in interface `Query`
  Overrides:
    `getMetaData` in class `IndirectQuery`

### getObjectId

    public ObjectId getObjectId()

### 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`

### getRoot

    public java.lang.Object getRoot()

  Deprecated. since 1.2

  Description copied from class: `IndirectQuery`
  This implementation throws an exception.

  Specified by:
    `getRoot` in interface `Query`
  Overrides:
    `getRoot` in class `IndirectQuery`

### getCachePolicy

    public int getCachePolicy()

### isFetchMandatory

    public boolean isFetchMandatory()

### isFetchAllowed

    public boolean isFetchAllowed()

### isFetchingDataRows

    public boolean isFetchingDataRows()

### toString

    public java.lang.String toString()

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

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

### equals

    public boolean equals(java.lang.Object object)

  An object is considered equal to this query if it is also a SingleObjectQuery with an equal ObjectId.

  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`

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.