public interface PreparedQuery
Query
. If the Query
specified a sort order, Entities
are returned in that order. Otherwise, the order
is undefined.
A PreparedQuery
does not cache results. Each use of PreparedQuery
results in a
new trip to the datastore.
Modifier and Type | Interface and Description |
---|---|
static class |
PreparedQuery.TooManyResultsException
Indicates that too many results were found for
asSingleEntity() . |
java.util.List<Entity> asList(FetchOptions fetchOptions)
Query
Entities
as a List
using the provided FetchOptions
.
Note that if FetchOptions.getLimit()
is greater than the number of Entities
, the length of the returned List
will be smaller thanFetchOptions.getLimit()
.
To operate on large result sets, you should prefer asIterable(com.google.appengine.api.datastore.FetchOptions)
and asIterator(com.google.appengine.api.datastore.FetchOptions)
, which stream the results from the datastore.
fetchOptions
- The fetch options to apply.List
.java.lang.IllegalStateException
- If the query being executed is associated with a Transaction
that is not active.FetchOptions
QueryResultList<Entity> asQueryResultList(FetchOptions fetchOptions)
asList(com.google.appengine.api.datastore.FetchOptions)
except a QueryResultIterator
is returned.java.lang.Iterable<Entity> asIterable(FetchOptions fetchOptions)
Query
Entities
as an Iterable
using the provided
FetchOptions
.
Each use of Iterable.iterator()
results in an entirely new and independent Iterator
.
fetchOptions
- The fetch options to apply.Iterable
.java.lang.IllegalStateException
- If the query being executed is associated with a Transaction
that is not active.FetchOptions
java.lang.Iterable<Entity> asIterable()
asIterable(FetchOptions)
but uses default FetchOptions
.QueryResultIterable<Entity> asQueryResultIterable(FetchOptions fetchOptions)
asIterable(FetchOptions)
except a QueryResultIterable
is returned.
Call this method to have (indirect) access to Cursor
s for your result set.QueryResultIterable<Entity> asQueryResultIterable()
asIterable()
except a QueryResultIterable
is returned. Call this
method to have (indirect) access to Cursor
s for your result set.java.util.Iterator<Entity> asIterator(FetchOptions fetchOptions)
fetchOptions
- The fetch strategy to apply.Iterator
.java.lang.IllegalStateException
- If the query being executed is associated with a Transaction
that is not active.FetchOptions
java.util.Iterator<Entity> asIterator()
asIterator(FetchOptions)
but uses default FetchOptions
.QueryResultIterator<Entity> asQueryResultIterator(FetchOptions fetchOptions)
asIterator(FetchOptions)
except a QueryResultIterator
is returned.
Call this method to have access to Cursor
s for your result set.QueryResultIterator<Entity> asQueryResultIterator()
asIterator()
except a QueryResultIterator
is returned. Call this
method to have access to Cursor
s for your result set.Entity asSingleEntity() throws PreparedQuery.TooManyResultsException
Query
.null
if no entities matchPreparedQuery.TooManyResultsException
- if more than one result is returned from the Query
.java.lang.IllegalStateException
- If the query being executed is associated with a Transaction
that is not active.int countEntities(FetchOptions fetchOptions)
java.lang.IllegalStateException
- If the query being executed is associated with a Transaction
that is not active.@Deprecated int countEntities()
countEntities(FetchOptions)
instead. Calling this function imposes a
maximum result limit of 1000.java.lang.IllegalStateException
- If the query being executed is associated with a Transaction
that is not active.