public abstract class SimpleQueryImpl<T> extends Object implements SimpleQuery<T>
Modifier and Type | Field and Description |
---|---|
protected LoaderImpl<?> |
loader |
Modifier and Type | Method and Description |
---|---|
QueryImpl<T> |
ancestor(Object keyOrEntity)
Restricts result set only to objects which have the given ancestor
somewhere in the chain.
|
QueryImpl<T> |
chunk(int value)
Sets the internal chunking and prefetching strategy within the low-level API.
|
QueryImpl<T> |
chunkAll()
Sets the internal chunking and prefetching strategy within the low-level API to attempt to get all
results at once.
|
QueryImpl<T> |
distinct(boolean value)
Determines whether this is a SELECT DISTINCT query.
|
QueryImpl<T> |
endAt(com.google.appengine.api.datastore.Cursor value)
Ends query results at the specified Cursor.
|
QueryImpl<T> |
filterKey(Object value)
An alias for
filterKey("=", value) |
QueryImpl<T> |
filterKey(String condition,
Object value)
Create a filter on the key of an entity.
|
QueryImpl<T> |
hybrid(boolean force)
This method forces Objectify to (or not to) hybridize the query into a keys-only fetch plus batch get.
|
QueryKeys<T> |
keys()
Switches to a keys-only query.
|
QueryImpl<T> |
limit(int value)
Limit the fetched result set to a certain number of values.
|
QueryImpl<T> |
offset(int value)
Starts the query results at a particular zero-based offset.
|
QueryImpl<T> |
orderKey(boolean descending)
Orders results by the key.
|
QueryImpl<T> |
reverse()
Reverse the query, as described in the GAE docs.
|
QueryImpl<T> |
startAt(com.google.appengine.api.datastore.Cursor value)
Starts query results at the specified Cursor.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
count, toString
first, iterable, list
protected LoaderImpl<?> loader
public QueryImpl<T> filterKey(String condition, Object value)
SimpleQuery
Create a filter on the key of an entity. Examples:
filterKey(">=", key)
(standard inequalities)filterKey("=", key)
(wouldn't you rather do a load-by-key?)filterKey("", key)
(if no operator, = is assumed)filterKey("!=", key)
filterKey("in", keyList)
(wouldn't you rather do a batch load-by-key?)The key parameter can be anything key-ish; a Key>, a native datastore key, a Ref, a pojo entity, etc.
See the Google documentation for indexes for an explanation of what you can and cannot filter for.
filterKey
in interface SimpleQuery<T>
public QueryImpl<T> filterKey(Object value)
SimpleQuery
filterKey("=", value)
filterKey
in interface SimpleQuery<T>
public QueryImpl<T> orderKey(boolean descending)
SimpleQuery
orderKey
in interface SimpleQuery<T>
descending
- if true, specifies a descending (aka reverse) sortpublic QueryImpl<T> ancestor(Object keyOrEntity)
SimpleQuery
ancestor
in interface SimpleQuery<T>
keyOrEntity
- can be a Key, a Keypublic QueryImpl<T> limit(int value)
SimpleQuery
limit
in interface SimpleQuery<T>
value
- must be >= 0. A value of 0 indicates no limit.public QueryImpl<T> offset(int value)
SimpleQuery
offset
in interface SimpleQuery<T>
value
- must be >= 0public QueryImpl<T> startAt(com.google.appengine.api.datastore.Cursor value)
SimpleQuery
startAt
in interface SimpleQuery<T>
public QueryImpl<T> endAt(com.google.appengine.api.datastore.Cursor value)
SimpleQuery
endAt
in interface SimpleQuery<T>
public QueryImpl<T> chunk(int value)
SimpleQuery
chunk
in interface SimpleQuery<T>
value
- must be >= 0public QueryImpl<T> distinct(boolean value)
SimpleQuery
distinct
in interface SimpleQuery<T>
public QueryImpl<T> hybrid(boolean force)
SimpleQuery
This method forces Objectify to (or not to) hybridize the query into a keys-only fetch plus batch get.
If Objectify knows you are fetching an entity type that can be cached, it automatically converts queries into a "hybrid" of keys-only query followed by a batch fetch of the keys. This is cheaper (keys-only results are 1/7th the price of a full fetch) and, if the cache hits, significantly faster. However, there are some circumstances in which you may wish to force behavior one way or another:
For the most part, hybridization only affects the performance and cost of queries. However, it is possible
for hybridization to alter the content of the result set. In the HRD, queries
always have EVENTUAL consistency but get operations may have either STRONG or EVENTUAL consistency depending
on the read policy (see Objectify.consistency()
. The keys-only query results will always be EVENTUAL and may
return data that has been deleted, but Objectify will exclude these results when the more-current batch get fails to return
data. So the count of the returned data may actually be less than the limit(), even if there are plenty of
actual results. hybrid(false)
will prevent this behavior.
Note that in hybrid queries, the chunk size defines the batch size.
hybrid
in interface SimpleQuery<T>
public QueryImpl<T> chunkAll()
SimpleQuery
Sets the internal chunking and prefetching strategy within the low-level API to attempt to get all results at once. Affects performance only; the result set will be the same.
Same as chunk(Integer.MAX_VALUE).
chunkAll
in interface SimpleQuery<T>
public QueryKeys<T> keys()
SimpleQuery
keys
in interface SimpleQuery<T>
public QueryImpl<T> reverse()
SimpleQuery
reverse
in interface SimpleQuery<T>
Copyright © 2014. All rights reserved.