public final class OrmQueryRequest<T> extends BeanRequest implements BeanQueryRequest<T>, SpiOrmQueryRequest<T>
| Constructor and Description |
|---|
OrmQueryRequest(SpiEbeanServer server,
OrmQueryEngine queryEngine,
SpiQuery<T> query,
BeanDescriptor<T> desc,
SpiTransaction t)
Create the InternalQueryRequest.
|
| Modifier and Type | Method and Description |
|---|---|
void |
calculateQueryPlanHash()
Calculate the query plan hash AFTER any potential AutoFetch tuning.
|
DeployParser |
createDeployParser() |
void |
endTransIfRequired()
Will end a locally created transaction.
|
void |
executeSecondaryQueries(int defaultQueryBatch) |
Object |
findId()
Execute the query as findById.
|
List<Object> |
findIds()
Execute the find ids query.
|
QueryIterator<T> |
findIterate()
Execute the find returning a QueryIterator.
|
List<T> |
findList()
Execute the query as findList.
|
Map<?,?> |
findMap()
Execute the query as findMap.
|
int |
findRowCount()
Execute the find row count query.
|
Set<?> |
findSet()
Execute the query as findSet.
|
void |
findVisit(QueryResultVisitor<T> visitor)
Execute the find returning a QueryIterator and visitor pattern.
|
void |
flushPersistenceContextOnIterate() |
BeanDescriptor<T> |
getBeanDescriptor()
Return the BeanDescriptor for the associated bean.
|
BeanFinder<T> |
getBeanFinder()
Return a bean specific finder if one has been set.
|
BeanCollection<T> |
getFromQueryCache()
Try to get the query result from the query cache.
|
LoadContext |
getGraphContext()
Return the graph context for this query.
|
BeanPropertyAssocMany<?> |
getManyProperty()
Return the many property that is fetched in the query or null if there is
not one.
|
PersistenceContext |
getPersistenceContext()
Return the PersistenceContext used for this request.
|
SpiQuery<T> |
getQuery()
Return the find that is to be performed.
|
CQueryPlan |
getQueryPlan()
Return a queryPlan for the current query if one exists.
|
HashQueryPlan |
getQueryPlanHash()
Return the queryPlanHash.
|
SpiQuery.Type |
getQueryType() |
int |
getSecondaryQueriesMinBatchSize(int defaultQueryBatch)
For use with QueryIterator and secondary queries this returns the minimum
batch size that should be loaded before executing the secondary queries.
|
void |
initTransIfRequired()
This will create a local (readOnly) transaction if no current transaction
exists.
|
boolean |
isFindById()
Return true if this is a find by id (rather than List Set or Map).
|
boolean |
isRawSql() |
Boolean |
isReadOnly()
Return the Normal, sharedInstance, ReadOnly state of this query.
|
boolean |
isSqlSelect()
Return true if this is a query using generated sql.
|
boolean |
isUseBeanCache() |
void |
logSql(String sql)
Log the SQL if the logLevel is appropriate.
|
void |
putQueryPlan(CQueryPlan queryPlan)
Put the QueryPlan into the cache.
|
void |
putToQueryCache(BeanCollection<T> queryResult) |
void |
setBackgroundFetching()
This query is using background fetching.
|
void |
setCancelableQuery(CancelableQuery cancelableQuery)
Set an Query object that owns the PreparedStatement that can be cancelled.
|
commitTransIfRequired, createImplicitTransIfRequired, getConnection, getEbeanServer, getServer, getTransaction, isLogSql, isLogSummary, rollbackTransIfRequiredclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetEbeanServer, getTransactionrollbackTransIfRequiredpublic OrmQueryRequest(SpiEbeanServer server, OrmQueryEngine queryEngine, SpiQuery<T> query, BeanDescriptor<T> desc, SpiTransaction t)
public void executeSecondaryQueries(int defaultQueryBatch)
public int getSecondaryQueriesMinBatchSize(int defaultQueryBatch)
If -1 is returned then NO secondary queries are registered and simple iteration is fine.
public Boolean isReadOnly()
public BeanDescriptor<T> getBeanDescriptor()
getBeanDescriptor in interface SpiOrmQueryRequest<T>public LoadContext getGraphContext()
public void calculateQueryPlanHash()
public boolean isRawSql()
public DeployParser createDeployParser()
public boolean isSqlSelect()
public PersistenceContext getPersistenceContext()
public void initTransIfRequired()
A transaction may have been passed in explicitly or currently be active in the thread local. If not, then a readOnly transaction is created to execute this query.
initTransIfRequired in interface SpiOrmQueryRequest<T>initTransIfRequired in class BeanRequestpublic void endTransIfRequired()
It ends the transaction by using a rollback() as the transaction is known to be readOnly.
endTransIfRequired in interface SpiOrmQueryRequest<T>public void setBackgroundFetching()
public boolean isFindById()
public Object findId()
findId in interface SpiOrmQueryRequest<T>public int findRowCount()
SpiOrmQueryRequestfindRowCount in interface SpiOrmQueryRequest<T>public List<Object> findIds()
SpiOrmQueryRequestfindIds in interface SpiOrmQueryRequest<T>public void findVisit(QueryResultVisitor<T> visitor)
SpiOrmQueryRequestfindVisit in interface SpiOrmQueryRequest<T>public QueryIterator<T> findIterate()
SpiOrmQueryRequestfindIterate in interface SpiOrmQueryRequest<T>public List<T> findList()
findList in interface SpiOrmQueryRequest<T>public Set<?> findSet()
findSet in interface SpiOrmQueryRequest<T>public Map<?,?> findMap()
findMap in interface SpiOrmQueryRequest<T>public SpiQuery.Type getQueryType()
public BeanFinder<T> getBeanFinder()
public SpiQuery<T> getQuery()
getQuery in interface BeanQueryRequest<T>getQuery in interface SpiOrmQueryRequest<T>public BeanPropertyAssocMany<?> getManyProperty()
public CQueryPlan getQueryPlan()
public HashQueryPlan getQueryPlanHash()
This identifies the query plan for a given bean type. It effectively matches a SQL statement with ? bind variables. A query plan can be reused with just the bind variables changing.
public void putQueryPlan(CQueryPlan queryPlan)
public boolean isUseBeanCache()
public BeanCollection<T> getFromQueryCache()
getFromQueryCache in interface SpiOrmQueryRequest<T>public void putToQueryCache(BeanCollection<T> queryResult)
public void setCancelableQuery(CancelableQuery cancelableQuery)
public void logSql(String sql)
public void flushPersistenceContextOnIterate()
Copyright © 2014. All Rights Reserved.