public class SelectById<T> extends IndirectQuery implements Select<T>
dataMap, lastResolver, name, replacementQuery
Constructor and Description |
---|
SelectById() |
Modifier and Type | Method and Description |
---|---|
SelectById<T> |
addPrefetch(PrefetchTreeNode prefetch)
Merges prefetch into the query prefetch tree.
|
SelectById<T> |
addPrefetch(String path,
int semantics)
Merges a prefetch path with specified semantics into the query prefetch
tree.
|
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() |
SelectById<T> |
prefetch(PrefetchTreeNode prefetch)
Resets internal prefetches to the new value.
|
SelectById<T> |
prefetch(String path,
int semantics)
Resets internal prefetches to the new value, which is a single prefetch
with specified semantics.
|
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) |
T |
selectOne(ObjectContext context)
Selects a single object using provided context.
|
SelectById<T> |
useLocalCache(String... cacheGroups)
Instructs Cayenne to look for query results in the "local" cache when
running the query.
|
SelectById<T> |
useSharedCache(String... cacheGroups) |
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 T selectOne(ObjectContext context)
CayenneRuntimeException
is
thrown. Since we are selecting by ID, multiple matched objects likely
indicate a database referential integrity problem.
Essentially the inversion of "ObjectContext.selectOne(Select)".
public SelectById<T> useLocalCache(String... cacheGroups)
query.setCacheStrategy(QueryCacheStrategy.LOCAL_CACHE); query.setCacheGroups("group1", "group2");
public SelectById<T> useSharedCache(String... cacheGroups)
public QueryCacheStrategy getCacheStrategy()
public String[] getCacheGroups()
public boolean isFetchingDataRows()
public SelectById<T> prefetch(String path, int semantics)
public SelectById<T> prefetch(PrefetchTreeNode prefetch)
public SelectById<T> addPrefetch(PrefetchTreeNode prefetch)
public SelectById<T> addPrefetch(String path, int semantics)
public PrefetchTreeNode getPrefetches()
protected Query createReplacementQuery(EntityResolver resolver)
IndirectQuery
createReplacementQuery
in class IndirectQuery
protected ObjEntity resolveEntity(EntityResolver resolver)
Copyright © 2001–2015 Apache Cayenne. All rights reserved.