public class SelectById<T> extends IndirectQuery implements Select<T>
dataMap, lastResolver, name, replacementQuery
Constructor and Description |
---|
SelectById() |
Modifier and Type | Method and Description |
---|---|
ResultBatchIterator<T> |
batchIterator(ObjectContext context,
int size)
Creates a ResultBatchIterator based on the provided context and batch
size.
|
SelectById<T> |
cacheGroups(Collection<String> cacheGroups) |
SelectById<T> |
cacheGroups(String... cacheGroups) |
SelectById<T> |
cacheStrategy(QueryCacheStrategy strategy,
String... cacheGroups) |
protected Query |
createReplacementQuery(EntityResolver resolver)
Creates a substitute query.
|
static SelectById<DataRow> |
dataRowQuery(Class<?> entityType,
Map<String,Object> id) |
static SelectById<DataRow> |
dataRowQuery(Class<?> entityType,
Object id) |
static SelectById<DataRow> |
dataRowQuery(ObjectId id) |
String[] |
getCacheGroups() |
QueryCacheStrategy |
getCacheStrategy() |
PrefetchTreeNode |
getPrefetches() |
boolean |
isFetchingDataRows() |
void |
iterate(ObjectContext context,
ResultIteratorCallback<T> callback)
Creates a ResultIterator based on the provided context and passes it to a
callback for processing.
|
ResultIterator<T> |
iterator(ObjectContext context)
Creates a ResultIterator based on the provided context.
|
SelectById<T> |
localCache(String... cacheGroups)
Instructs Cayenne to look for query results in the "local" cache when
running the query.
|
SelectById<T> |
prefetch(PrefetchTreeNode prefetch)
Merges prefetch into the query prefetch tree.
|
SelectById<T> |
prefetch(String path,
int semantics)
Merges a prefetch path with specified semantics into the query prefetch
tree.
|
static <T> SelectById<T> |
query(Class<T> entityType,
Map<String,?> id) |
static <T> SelectById<T> |
query(Class<T> entityType,
Object id) |
static <T> SelectById<T> |
query(Class<T> entityType,
ObjectId id) |
protected ObjEntity |
resolveEntity(EntityResolver resolver) |
protected Map<String,?> |
resolveId(ObjEntity entity) |
List<T> |
select(ObjectContext context)
Selects objects using provided context.
|
T |
selectFirst(ObjectContext context)
Since we are selecting by ID, we don't need to limit fetch size.
|
T |
selectOne(ObjectContext context)
Since we are selecting by ID, multiple matched objects likely indicate a
database referential integrity problem.
|
SelectById<T> |
sharedCache(String... cacheGroups)
Instructs Cayenne to look for query results in the "shared" cache when
running the query.
|
SelectById<T> |
useLocalCache(String... cacheGroups)
Deprecated.
since 4.0.M3 use
localCache(String...) |
SelectById<T> |
useSharedCache(String... cacheGroups)
Deprecated.
since 4.0.M3 use
sharedCache(String...) |
acceptVisitor, createSQLAction, getDataMap, getMetaData, getName, getReplacementQuery, route, setDataMap, setName
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createSQLAction, getDataMap, getMetaData, getName, route
acceptVisitor
public static <T> SelectById<T> query(Class<T> entityType, Object id)
public static <T> SelectById<T> query(Class<T> entityType, Map<String,?> id)
public static <T> SelectById<T> query(Class<T> entityType, ObjectId id)
public static SelectById<DataRow> dataRowQuery(Class<?> entityType, Object id)
public static SelectById<DataRow> dataRowQuery(Class<?> entityType, Map<String,Object> id)
public static SelectById<DataRow> dataRowQuery(ObjectId id)
public List<T> select(ObjectContext context)
Select
Essentially the inversion of "ObjectContext.select(Select)".
public T selectOne(ObjectContext context)
public T selectFirst(ObjectContext context)
selectFirst
in interface Select<T>
public void iterate(ObjectContext context, ResultIteratorCallback<T> callback)
Select
Essentially the inversion of "ObjectContext.iterate(Select, ResultIteratorCallback)".
public ResultIterator<T> iterator(ObjectContext context)
Select
Select.iterate(ObjectContext, ResultIteratorCallback)
as an
alternative.
Essentially the inversion of "ObjectContext.iterator(Select)".
public ResultBatchIterator<T> batchIterator(ObjectContext context, int size)
Select
batchIterator
in interface Select<T>
public SelectById<T> localCache(String... cacheGroups)
query.cacheStrategy(QueryCacheStrategy.LOCAL_CACHE, cacheGroups);
public SelectById<T> sharedCache(String... cacheGroups)
query.cacheStrategy(QueryCacheStrategy.SHARED_CACHE, cacheGroups);
@Deprecated public SelectById<T> useLocalCache(String... cacheGroups)
localCache(String...)
@Deprecated public SelectById<T> useSharedCache(String... cacheGroups)
sharedCache(String...)
public QueryCacheStrategy getCacheStrategy()
public SelectById<T> cacheStrategy(QueryCacheStrategy strategy, String... cacheGroups)
public String[] getCacheGroups()
public SelectById<T> cacheGroups(String... cacheGroups)
public SelectById<T> cacheGroups(Collection<String> cacheGroups)
public boolean isFetchingDataRows()
public SelectById<T> prefetch(PrefetchTreeNode prefetch)
public SelectById<T> prefetch(String path, int semantics)
public PrefetchTreeNode getPrefetches()
protected Query createReplacementQuery(EntityResolver resolver)
IndirectQuery
createReplacementQuery
in class IndirectQuery
protected ObjEntity resolveEntity(EntityResolver resolver)
Copyright © 2001–2016 Apache Cayenne. All rights reserved.