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 RelationshipQuery

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

All Implemented Interfaces:
  java.io.Serializable, Query

    public class RelationshipQuery

extends IndirectQuery

A query that selects objects related to a given object. It is intended for fetching objects related to a given object using a mapped relationship. Cayenne uses it for this purpose internally. RelationshipQuery works with either an ObjectId or a GlobalID for a root object.

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

Field Summary
`protected QueryMetadata` | `metadata`
`protected EntityResolver` | `metadataResolver`
`protected ObjectId` | `objectId`
`protected boolean` | `refreshing`
`protected ObjRelationship` | `relationship`
`protected java.lang.String` | `relationshipName`

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

Constructor Summary
`RelationshipQuery(ObjectId objectID, java.lang.String relationshipName)` Creates a RelationshipQuery.
`RelationshipQuery(ObjectId objectID, java.lang.String relationshipName, boolean refreshing)` Creates a RelationshipQuery.

Method Summary
`protected Query` | `createReplacementQuery(EntityResolver resolver)` Creates a substitute query.
`QueryMetadata` | `getMetaData(EntityResolver resolver)` Returns query metadata object.
`ObjectId` | `getObjectId()`
`ObjRelationship` | `getRelationship(EntityResolver resolver)` Returns a non-null relationship object for this query.
`java.lang.String` | `getRelationshipName()`
`boolean` | `isRefreshing()`
`java.lang.String` | `toString()` Overrides toString() outputting a short string with query class and relationship 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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### objectId

    protected ObjectId objectId

### relationshipName

    protected java.lang.String relationshipName

### refreshing

    protected boolean refreshing

### metadataResolver

    protected transient EntityResolver metadataResolver

### metadata

    protected transient QueryMetadata metadata

### relationship

    protected transient ObjRelationship relationship

Constructor Detail

### RelationshipQuery

    public RelationshipQuery(ObjectId objectID,
                             java.lang.String relationshipName)

  Creates a RelationshipQuery. Same as new RelationshipQuery(objectID, relationshipName, true).

  Parameters:
    `objectID` - ObjectId of a root object of the relationship.
    `relationshipName` - The name of the relationship.

### RelationshipQuery

    public RelationshipQuery(ObjectId objectID,
                             java.lang.String relationshipName,
                             boolean refreshing)

  Creates a RelationshipQuery.

  Parameters:
    `objectID` - ObjectId of a root object of the relationship.
    `relationshipName` - The name of the relationship.
    `refreshing` - whether objects should be refreshed

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

### isRefreshing

    public boolean isRefreshing()

### getRelationshipName

    public java.lang.String getRelationshipName()

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

### getRelationship

    public ObjRelationship getRelationship(EntityResolver resolver)

  Returns a non-null relationship object for this query.

### toString

    public java.lang.String toString()

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

  Overrides:
    `toString` 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.