Package org.apache.cayenne.query
Class RelationshipQuery
java.lang.Object
org.apache.cayenne.query.IndirectQuery
org.apache.cayenne.query.RelationshipQuery
- All Implemented Interfaces:
Serializable
,Query
A query that selects objects related to a given object via a mapped relationship.
RelationshipQuery is used by Cayenne internally to resolve relationships, and is rarely
executed by the application directly, although this of course is possible too.
- Since:
- 1.2
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected ArcProperty
protected QueryMetadata
protected EntityResolver
protected ObjectId
protected boolean
protected String
protected int
Fields inherited from class org.apache.cayenne.query.IndirectQuery
dataMap, lastResolver, name, replacementQuery
-
Constructor Summary
ConstructorDescriptionRelationshipQuery
(ObjectId objectID, String relationshipName) Creates a RelationshipQuery.RelationshipQuery
(ObjectId objectID, String relationshipName, boolean refreshing) Creates a RelationshipQuery. -
Method Summary
Modifier and TypeMethodDescriptionprotected Query
createReplacementQuery
(EntityResolver resolver) Creates a substitute query.getMetaData
(EntityResolver resolver) Returns query metadata object.getRelationship
(EntityResolver resolver) Returns a non-null relationship object for this query.int
boolean
void
setStatementFetchSize
(int size) Sets statement's fetch size (0 for no default size)toString()
Overrides toString() outputting a short string with query class and relationship name.Methods inherited from class org.apache.cayenne.query.IndirectQuery
createSQLAction, getReplacementQuery, route
-
Field Details
-
objectId
-
relationshipName
-
refreshing
protected boolean refreshing -
statementFetchSize
protected int statementFetchSize -
metadataResolver
-
metadata
-
arc
-
-
Constructor Details
-
RelationshipQuery
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
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 Details
-
getMetaData
Returns query metadata object.- Specified by:
getMetaData
in interfaceQuery
- Overrides:
getMetaData
in classIndirectQuery
-
getObjectId
-
isRefreshing
public boolean isRefreshing() -
getRelationshipName
-
createReplacementQuery
Description copied from class:IndirectQuery
Creates a substitute query. An implementor is free to provide an arbitrary replacement query.- Specified by:
createReplacementQuery
in classIndirectQuery
-
getRelationship
Returns a non-null relationship object for this query. -
setStatementFetchSize
public void setStatementFetchSize(int size) Sets statement's fetch size (0 for no default size)- Since:
- 3.0
-
getStatementFetchSize
public int getStatementFetchSize()- Returns:
- statement's fetch size
- Since:
- 3.0
-
toString
Overrides toString() outputting a short string with query class and relationship name.
-