Package org.apache.cayenne.query
Class ObjectIdQuery
java.lang.Object
org.apache.cayenne.query.IndirectQuery
org.apache.cayenne.query.ObjectIdQuery
- All Implemented Interfaces:
Serializable,Query
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 significantly different from all other of the queries.- Since:
- 1.2
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intprotected intprotected booleanprotected QueryMetadataprotected EntityResolverprotected ObjectIdFields inherited from class org.apache.cayenne.query.IndirectQuery
dataMap, lastResolver, name, replacementQuery -
Constructor Summary
ConstructorsConstructorDescriptionObjectIdQuery(ObjectId objectID) Creates a refreshing ObjectIdQuery.ObjectIdQuery(ObjectId objectId, boolean fetchingDataRows, int cachePolicy) Creates a new ObjectIdQuery. -
Method Summary
Modifier and TypeMethodDescriptionprotected QuerycreateReplacementQuery(EntityResolver resolver) Creates a substitute query.booleanAn object is considered equal to this query if it is also a ObjectIdQuery with an equal ObjectId.intgetMetaData(EntityResolver resolver) Returns query metadata object.inthashCode()Implements a standard hashCode contract considering custom 'equals' implementation.booleanbooleanbooleantoString()Overrides toString() outputting a short string with query class and ObjectId.Methods inherited from class org.apache.cayenne.query.IndirectQuery
createSQLAction, getReplacementQuery, route
-
Field Details
-
CACHE
public static final int CACHE- See Also:
-
CACHE_REFRESH
public static final int CACHE_REFRESH- See Also:
-
CACHE_NOREFRESH
public static final int CACHE_NOREFRESH- See Also:
-
objectId
-
cachePolicy
protected int cachePolicy -
fetchingDataRows
protected boolean fetchingDataRows -
metadataResolver
-
metadata
-
-
Constructor Details
-
ObjectIdQuery
Creates a refreshing ObjectIdQuery. -
ObjectIdQuery
Creates a new ObjectIdQuery.
-
-
Method Details
-
getMetaData
Returns query metadata object.- Specified by:
getMetaDatain interfaceQuery- Overrides:
getMetaDatain classIndirectQuery
-
getObjectId
-
createReplacementQuery
Description copied from class:IndirectQueryCreates a substitute query. An implementor is free to provide an arbitrary replacement query.- Specified by:
createReplacementQueryin classIndirectQuery
-
getCachePolicy
public int getCachePolicy() -
isFetchMandatory
public boolean isFetchMandatory() -
isFetchAllowed
public boolean isFetchAllowed() -
isFetchingDataRows
public boolean isFetchingDataRows() -
toString
Overrides toString() outputting a short string with query class and ObjectId. -
equals
An object is considered equal to this query if it is also a ObjectIdQuery with an equal ObjectId. -
hashCode
public int hashCode()Implements a standard hashCode contract considering custom 'equals' implementation.
-