public interface SpiQuery<T> extends Query<T>
| Type | Property and Description |
|---|---|
boolean |
selectAllForLazyLoad
Return true if select all properties was used to ensure the property
invoking a lazy load was included in the query.
|
| Modifier and Type | Interface and Description |
|---|---|
static class |
SpiQuery.Mode |
static class |
SpiQuery.Type
The type of query result.
|
| Modifier and Type | Method and Description |
|---|---|
void |
contextAdd(EntityBean bean)
Adds this bean to the persistence context prior to executing the query.
|
void |
convertManyFetchJoinsToQueryJoins(boolean allowOne,
int queryBatch)
Convert any many joins fetch joins to query joins.
|
void |
convertWhereNaturalKeyToId(Object idValue)
Convert this natural key query into a find by id query.
|
SpiQuery<T> |
copy()
Return a copy of the query.
|
boolean |
createOwnTransaction()
Return true if this query should use its own transaction.
|
String |
getAdditionalHaving()
Return additional having clause.
|
String |
getAdditionalWhere()
Return additional where clause.
|
AutoFetchManager |
getAutoFetchManager()
If return null then no autoFetch profiling for this query.
|
int |
getBackgroundFetchAfter()
Return the number of rows after which fetching should occur in a
background thread.
|
BeanCollectionTouched |
getBeanCollectionTouched()
Return a listener that wants to be notified when the bean collection is
first used.
|
Class<T> |
getBeanType()
Return the type of beans queries.
|
BindParams |
getBindParams()
Return the bind parameters.
|
int |
getBufferFetchSizeHint()
Return the hint for Statement.setFetchSize().
|
ArrayList<EntityBean> |
getContextAdditions()
Return the objects that should be added to the persistence context prior
to executing the query.
|
OrmQueryDetail |
getDetail()
Return the query detail.
|
int |
getFirstRow()
Return the index of the first row to return in the query.
|
SpiExpressionList<T> |
getHavingExpressions()
Can return null if no expressions where added to the having clause.
|
Object |
getId()
Return the Id value.
|
List<Object> |
getIdList()
Return the list of Id's that is currently being fetched by a background
thread.
|
TableJoin |
getIncludeTableJoin() |
List<Object> |
getLazyLoadForParentIds()
Return the list of parent Id's for lazy loading.
|
BeanPropertyAssocMany<?> |
getLazyLoadForParentsProperty()
Return the lazy loading 'many' property.
|
String |
getLazyLoadManyPath()
Return the lazy load path.
|
String |
getLazyLoadProperty()
Return the property that invoked lazy load.
|
QueryListener<T> |
getListener()
Return the queryListener.
|
String |
getLoadDescription()
Return a more detailed description of the lazy or query load.
|
String |
getLoadMode()
Return the load mode (+lazy or +query).
|
ManyWhereJoins |
getManyWhereJoins()
Return the joins required to support predicates on the many properties.
|
String |
getMapKey()
Return the property used to specify keys for a map.
|
int |
getMaxRows()
Return the maximum number of rows to return in the query.
|
SpiQuery.Mode |
getMode()
Return the query mode.
|
String |
getName()
Return the query name.
|
NaturalKeyBindParam |
getNaturalKeyBindParam()
Return a Natural Key bind parameter if supported by this query.
|
OrderBy<T> |
getOrderBy()
Return the Order By clause or null if there is none defined.
|
ObjectGraphNode |
getParentNode()
Used to hook back a lazy loading query to the original query (query
point).
|
PersistenceContext |
getPersistenceContext()
Return the TransactionContext.
|
String |
getQuery()
Get the orm query as a String.
|
String |
getRawWhereClause()
Return the where clause from a parsed string query.
|
int |
getTimeout()
Return the query timeout.
|
SpiQuery.Type |
getType()
Return the type of query (List, Set, Map, Bean, rowCount etc).
|
SpiExpressionList<T> |
getWhereExpressions()
Can return null if no expressions where added to the where clause.
|
boolean |
hasMaxRowsOrFirstRow()
Returns true if either firstRow or maxRows has been set.
|
boolean |
initManyWhereJoins()
Initialise/determine the joins required to support 'many' where clause predicates.
|
Boolean |
isAutofetch()
Return explicit autoFetch setting or null.
|
boolean |
isCancelled()
Return true if this query has been cancelled.
|
boolean |
isDetailEmpty()
Return true if the query detail has neither select or joins specified.
|
boolean |
isDistinct()
return true if this query uses DISTINCT.
|
boolean |
isFutureFetch()
Return true if this is a query executing in the background.
|
boolean |
isLoadBeanCache()
Return true if the beans from this query should be loaded into the bean
cache.
|
boolean |
isRawSql()
Return true if this is a RawSql query.
|
Boolean |
isReadOnly()
Return true if the beans returned by this query should be read only.
|
boolean |
isSqlSelect()
Return true if this is a query based on a SqlSelect rather than
generated.
|
boolean |
isUsageProfiling()
Return false when this is a lazy load or refresh query for a bean.
|
Boolean |
isUseBeanCache()
Return true if this query should use/check the bean cache.
|
boolean |
isUseQueryCache()
Return true if this query should use/check the query cache.
|
HashQueryPlan |
queryAutofetchHash(HashQueryPlanBuilder builder)
Calculate a hash used by AutoFetch to identify when a query has changed
(and hence potentially needs a new tuned query plan to be developed).
|
int |
queryBindHash()
Calculate a hash based on the bind values used in the query.
|
HashQuery |
queryHash()
Identifies queries that are exactly the same including bind variables.
|
HashQueryPlan |
queryPlanHash(BeanQueryRequest<?> request)
Identifies queries that are the same bar the bind variables.
|
List<OrmQueryProperties> |
removeLazyJoins()
Remove the lazy joins from query detail.
|
List<OrmQueryProperties> |
removeQueryJoins()
Remove the query joins from query detail.
|
boolean |
selectAllForLazyLoadProperty()
Return true if select all properties was used to ensure the property
invoking a lazy load was included in the query.
|
void |
setAutoFetchManager(AutoFetchManager manager)
This has the effect of turning on autoFetch profiling for this query.
|
void |
setAutoFetchTuned(boolean autoFetchTuned)
Set to true if this query has been tuned by autoFetch.
|
void |
setBeanCollectionTouched(BeanCollectionTouched notify)
Set a listener to be notified when the bean collection has been touched
(when the list/set/map is first used).
|
void |
setBeanDescriptor(BeanDescriptor<?> desc)
Set the BeanDescriptor for the root type of this query.
|
void |
setCancelableQuery(CancelableQuery cancelableQuery)
Set the underlying cancelable query (with the PreparedStatement).
|
void |
setDefaultSelectClause()
Set default select clauses where none have been explicitly defined.
|
void |
setDetail(OrmQueryDetail detail)
Replace the query detail.
|
void |
setFilterMany(String prop,
ExpressionList<?> filterMany)
Set a filter to a join path.
|
void |
setFutureFetch(boolean futureFetch)
Set to true to indicate the query is executing in a background thread
asynchronously.
|
void |
setGeneratedSql(String generatedSql)
Set the generated sql for debug purposes.
|
void |
setIdList(List<Object> ids)
Set the list of Id's that is being populated.
|
void |
setIncludeTableJoin(TableJoin includeTableJoin) |
void |
setLazyLoadForParents(List<Object> parentIds,
BeanPropertyAssocMany<?> many)
This becomes a lazy loading query for a many relationship.
|
void |
setLazyLoadManyPath(String lazyLoadManyPath)
Set the path of the many when +query/+lazy loading query is executed.
|
void |
setLazyLoadProperty(String lazyLoadProperty)
Set the property that invoked the lazy load and MUST be included in the
lazy loading query.
|
void |
setLoadDescription(String loadMode,
String loadDescription)
Set the load mode (+lazy or +query) and the load description.
|
void |
setMode(SpiQuery.Mode m)
Set the query mode.
|
ObjectGraphNode |
setOrigin(CallStack callStack)
Return the origin point for the query.
|
void |
setParentNode(ObjectGraphNode node)
Set the profile point of the bean or collection that is lazy loading.
|
void |
setPersistenceContext(PersistenceContext transactionContext)
Set an explicit TransactionContext (typically for a refresh query).
|
void |
setSelectId()
Set the query to select the id property only.
|
void |
setType(SpiQuery.Type type)
Set the query type (List, Set etc).
|
void |
setUsageProfiling(boolean usageProfiling)
Set to false if this query should not be included in the autoFetch usage
profiling information.
|
boolean |
tuneFetchProperties(OrmQueryDetail detail)
Autofetch tune the detail specifying properties to select on already defined joins
and adding extra joins where they are missing.
|
cancel, fetch, fetch, fetch, fetch, filterMany, findFutureIds, findFutureList, findFutureRowCount, findIds, findIterate, findList, findMap, findMap, findPagingList, findRowCount, findSet, findUnique, findVisit, getExpressionFactory, getGeneratedSql, getRawSql, having, having, having, isAutofetchTuned, isForUpdate, order, order, orderBy, orderBy, select, setAutofetch, setBackgroundFetchAfter, setBufferFetchSizeHint, setDistinct, setFirstRow, setForUpdate, setId, setListener, setLoadBeanCache, setMapKey, setMaxRows, setOrder, setOrderBy, setParameter, setParameter, setRawSql, setReadOnly, setTimeout, setUseCache, setUseQueryCache, where, where, whereboolean selectAllForLazyLoadProperty()
void setMode(SpiQuery.Mode m)
SpiQuery.Mode getMode()
BeanCollectionTouched getBeanCollectionTouched()
void setBeanCollectionTouched(BeanCollectionTouched notify)
void setIdList(List<Object> ids)
This is a mutating list of id's and we are setting this so that other threads have access to the id's before the id query has finished.
List<Object> getIdList()
SpiQuery.Type getType()
void setType(SpiQuery.Type type)
String getLoadDescription()
String getLoadMode()
void setLazyLoadForParents(List<Object> parentIds, BeanPropertyAssocMany<?> many)
BeanPropertyAssocMany<?> getLazyLoadForParentsProperty()
List<Object> getLazyLoadForParentIds()
void setLoadDescription(String loadMode, String loadDescription)
void setBeanDescriptor(BeanDescriptor<?> desc)
boolean initManyWhereJoins()
ManyWhereJoins getManyWhereJoins()
void convertWhereNaturalKeyToId(Object idValue)
NaturalKeyBindParam getNaturalKeyBindParam()
void setSelectId()
void setFilterMany(String prop, ExpressionList<?> filterMany)
List<OrmQueryProperties> removeQueryJoins()
These are registered with the Load Context.
List<OrmQueryProperties> removeLazyJoins()
These are registered with the Load Context.
void setLazyLoadManyPath(String lazyLoadManyPath)
void convertManyFetchJoinsToQueryJoins(boolean allowOne,
int queryBatch)
PersistenceContext getPersistenceContext()
If no TransactionContext is present on the query then the TransactionContext from the Transaction is used (transaction scoped persistence context).
void setPersistenceContext(PersistenceContext transactionContext)
If no TransactionContext is present on the query then the TransactionContext from the Transaction is used (transaction scoped persistence context).
boolean isDetailEmpty()
Boolean isAutofetch()
AutoFetchManager getAutoFetchManager()
void setAutoFetchManager(AutoFetchManager manager)
ObjectGraphNode setOrigin(CallStack callStack)
This MUST be call prior to a query being changed via tuning. This is because the queryPlanHash is used to identify the query point.
void setParentNode(ObjectGraphNode node)
This enables use to hook this back to the original 'root' query by the queryPlanHash and stackPoint.
void setLazyLoadProperty(String lazyLoadProperty)
String getLazyLoadProperty()
String getLazyLoadManyPath()
ObjectGraphNode getParentNode()
This will return null or an "original" query.
boolean isUsageProfiling()
We just take/copy the data from those beans and don't collect autoFetch usage profiling on those lazy load or refresh beans.
void setUsageProfiling(boolean usageProfiling)
String getName()
HashQueryPlan queryAutofetchHash(HashQueryPlanBuilder builder)
Excludes bind values and occurs prior to AutoFetch potentially tuning/modifying the query.
HashQueryPlan queryPlanHash(BeanQueryRequest<?> request)
This is used AFTER AutoFetch has potentially tuned the query. This is used to identify and reused query plans (the final SQL string and associated SqlTree object).
Excludes the actual bind values (as they don't effect the query plan).
int queryBindHash()
Combined with queryPlanHash() to return getQueryHash (a unique hash for a query).
HashQuery queryHash()
boolean isSqlSelect()
boolean isRawSql()
String getAdditionalWhere()
SpiExpressionList<T> getWhereExpressions()
SpiExpressionList<T> getHavingExpressions()
String getAdditionalHaving()
boolean hasMaxRowsOrFirstRow()
Boolean isUseBeanCache()
boolean isUseQueryCache()
boolean isLoadBeanCache()
Boolean isReadOnly()
void contextAdd(EntityBean bean)
int getTimeout()
ArrayList<EntityBean> getContextAdditions()
BindParams getBindParams()
String getQuery()
void setDetail(OrmQueryDetail detail)
Note care must be taken to keep the where, orderBy, firstRows and maxRows held in the detail attributes.
boolean tuneFetchProperties(OrmQueryDetail detail)
void setAutoFetchTuned(boolean autoFetchTuned)
OrmQueryDetail getDetail()
TableJoin getIncludeTableJoin()
void setIncludeTableJoin(TableJoin includeTableJoin)
String getMapKey()
int getBackgroundFetchAfter()
int getMaxRows()
getMaxRows in interface Query<T>int getFirstRow()
getFirstRow in interface Query<T>boolean isDistinct()
void setDefaultSelectClause()
String getRawWhereClause()
Object getId()
QueryListener<T> getListener()
boolean createOwnTransaction()
This is true for background fetching and when using QueryListener.
void setGeneratedSql(String generatedSql)
generatedSql - int getBufferFetchSizeHint()
boolean isFutureFetch()
void setFutureFetch(boolean futureFetch)
void setCancelableQuery(CancelableQuery cancelableQuery)
boolean isCancelled()
Copyright © 2014. All Rights Reserved.