- All Superinterfaces:
CancelableQuery,Query<T>,QueryBuilder<Query<T>,,T> QueryBuilderProjection<Query<T>,,T> SpiCancelableQuery,SpiQueryFetch,TxnProfileEventCodes
- All Known Implementing Classes:
DefaultOrmQuery
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumstatic enumstatic enumThe type of query result.Nested classes/interfaces inherited from interface io.ebean.Query
Query.LockType, Query.LockWait, Query.Property<T> -
Field Summary
Fields inherited from interface io.ebeaninternal.api.TxnProfileEventCodes
EVT_CALLABLESQL, EVT_COMMIT, EVT_DELETE, EVT_DELETE_PERMANENT, EVT_DELETE_SOFT, EVT_INSERT, EVT_ORMUPDATE, EVT_ROLLBACK, EVT_UPDATE, EVT_UPDATESQL, FIND_ATTRIBUTE, FIND_ATTRIBUTE_SET, FIND_COUNT, FIND_DELETE, FIND_EXISTS, FIND_ID_LIST, FIND_ITERATE, FIND_MANY, FIND_MANY_LAZY, FIND_ONE, FIND_ONE_LAZY, FIND_SUBQUERY, FIND_UPDATE -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSoftDeletePredicate(String softDeletePredicate) alias()Return root table alias set byQueryBuilder.alias(String)command.Return the base table to use if user defined on the query.Return the cache mode for using the bean cache (Get and Put).Return the bind parameters.intReturn the hint for Statement.setFetchSize().Bean cache lookup for find by ids.voidCheck that the named parameters have had their values set.booleanReturn true if the query should have an order by appended automatically.Convert joins as necessary to query joins etc.copy()Return a copy of the query.copy(SpiEbeanServer server) Return a copy of the query attaching to a different EbeanServer.Returns the count distinct order setting.createNamedParameter(String parameterName) Create a named parameter placeholder.Return the bean descriptor for this query.detail()Return the query detail.Return the distinct on clause.voidfetchProperties(String path, OrmQueryProperties other) Set the fetch properties for the given path.Return root table alias with default option.getAsOf()Return the asOf Timestamp which the query should run as.intReturn the table alias used for the base table.intReturn the index of the first row to return in the query.Return the ForUpdate mode.intReturn the maximum number of rows to return in the query.Return the Order By clause or null if there is none defined.Return the origin key.voidhandleLoadError(String fullName, Exception e) Handles load errors.booleanReturns true if either firstRow or maxRows has been set.Can return null if no expressions where added to the having clause.hint()Return the SQL hint to include in the query.voidIncrement the counter of tables used in 'As Of' query.voidincrementAsOfTableCount(int asOfTableCount) Increment the counter of tables used in 'As Of' query.Return the bind parameters ensuring it is initialised.booleanReturn true if the base table is using history.booleanReturn true if this is a 'As Of' query.booleanReturn true if AutoTune should be attempted on this query.Return explicit AutoTune setting or null.booleanReturn true if the query should GET against bean cache.booleanReturn true if the query should PUT against the bean cache.booleanReturn true if the query detail has neither select or joins specified.booleanReturn true if lazy loading has been disabled on the query.booleanReturn true if this query has been specified by a user to use DISTINCT.booleanReturn true if this is a "find all" query.booleanReturn true if this is a "find by id" query.booleanReturn true if we must hit the DB (Cache reload or select for update).booleanReturn true if this query includes soft deleted rows.booleanReturn true if the Id property is manually included in the query (DTO queries).booleanReturn true if this is a native sql query.booleanisRawSql()Return true if this is a RawSql query.booleanReturn true if this is singleAttribute query.booleanReturn true if the beans returned by this query should be unmodifiable.booleanReturn false when this is a lazy load or refresh query for a bean.booleanReturn true if this query should not use the read only data source.booleanReturn true if this is a future query.booleanReturn true if this is a find versions between query.booleanisWithId()Return true if the query should include the Id property.label()Return the label set on the query.intReturn the default lazy load batch size.Return the lazy loading 'many' property.Return the property that invoked lazy load.Return a more detailed description of the lazy or query load.loadMode()Return the load mode (+lazy or +query).Return the extra join for a M2M lazy load.Return the joins required to support predicates on the many properties.mapKey()Return the property used to specify keys for a map.mode()Return the query mode.Return the unmodified native sql query (with named params etc).Collect natural key data for this query or null if the query does not match the requirements of natural key lookup.Return a Natural Key bind parameter if supported by this query.booleanReturn true if there is no Order By clause.Used to hook back a lazy loading query to the original query (query point).Return the TransactionContext.Return the PersistenceContextScope that this query should use.Return the label manually set on the query or from the profile location.prepare(SpiOrmQueryRequest<T> request) Prepare the query which prepares sub-query expressions and calculates and returns the query plan key.Return the profile event id based on query mode and type.Return the id used to identify a particular query for the given bean type.Return the profile location for this query.If return null then no profiling for this query.voidBuild the key for the bind values used in the query (for l2 query cache).Return the cache mode if this query should use/check the query cache.Identifies queries that are exactly the same including bind variables.Return the query plan key.rawSql()Return the RawSql that was set to use for this query.voidresetBeanCacheAutoMode(boolean findOne) Reset AUTO mode to OFF for findList().Return secondary queries if required.voidReturn true if select all properties was used to ensure the property invoking a lazy load was included in the query.voidSet the select properties.voidsetArrayParameter(String name, Collection<?> values) Bind the named multi-value array parameter which we would use with Postgres ANY.voidSet when the base table is using history.voidsetAutoTuned(boolean autoTuned) Set to true if this query has been tuned by autoTune.voidsetDefaultFetchBuffer(int fetchSize) Set the JDBC fetchSize buffer hint if not explicitly set.voidSet default select clauses where none have been explicitly defined.Set the query to be delete by ids due to cascading delete.voidsetDetail(OrmQueryDetail detail) Replace the query detail.voidsetFilterMany(String prop, ExpressionList<?> filterMany) Set a filter to a join path.voidsetGeneratedSql(String generatedSql) Set the generated sql for debug purposes.voidThis becomes a lazy loading query for a many relationship.voidsetLazyLoadManyPath(String lazyLoadManyPath) Set the path of the many when +query/+lazy loading query is executed.voidsetLazyLoadProperty(String lazyLoadProperty) Set the property that invoked the lazy load and MUST be included in the lazy loading query.voidsetLoadDescription(String loadMode, String loadDescription) Set the load mode (+lazy or +query) and the load description.voidsetM2MIncludeJoin(TableJoin includeTableJoin) Set the extra join for a M2M lazy load.voidSet to true when we only include the Id property if it is explicitly included in the select().voidSet the query mode.setOrigin(CallOrigin callOrigin) Return the origin point for the query.voidsetParentNode(ObjectGraphNode node) Set the profile point of the bean or collection that is lazy loading.voidsetPersistenceContext(PersistenceContext transactionContext) Set an explicit TransactionContext (typically for a refresh query).voidsetProfilePath(String label, String relativePath, @Nullable ProfileLocation profileLocation) Set the on a secondary query given the label, relativePath and profile location of the parent query.voidsetProfilingListener(ProfilingListener manager) This has the effect of turning on profiling for this query.voidSet the query to select the id property only.voidMark the query as selecting a single attribute.voidsetTenantId(Object tenantId) Set the tenantId to use for lazy loading.voidsetType(SpiQuery.Type type) Set the query type (List, Set etc).voidSet the query to be a delete query.voidsetUsageProfiling(boolean usageProfiling) Set to false if this query should not be included in the AutoTune usage profiling information.voidSimplify nested expression lists where possible.Return the Temporal mode for the query.tenantId()Return the tenantId to use for lazy loading.inttimeout()Return the query timeout.Return the transaction explicitly assigned or null.booleantuneFetchProperties(OrmQueryDetail detail) AutoTune tune the detail specifying properties to select on already defined joins and adding extra joins where they are missing.type()Return the type of query (List, Set, Map, Bean, rowCount etc).Return the properties for an update query.voidSet that this is a future query that will execute in the background.Validate the query returning the set of properties with unknown paths.Return the find versions end timestamp.Return the find versions start timestamp.Can return null if no expressions where added to the where clause.Methods inherited from interface io.ebean.CancelableQuery
cancelMethods inherited from interface io.ebean.Query
filterMany, getExpressionFactory, getForUpdateLockType, getId, getQueryType, having, having, isAutoTuned, isCountDistinct, isForUpdate, orderBy, setId, setParameter, setParameter, setParameter, setParameters, setProfileLocation, update, where, whereMethods inherited from interface io.ebean.QueryBuilder
alias, also, alsoIf, asDto, asOf, asUpdate, delete, exists, findCount, findEach, findEach, findEachWhile, findFutureCount, findFutureIds, findFutureList, findFutureMap, findIds, findIterate, findList, findMap, findOne, findOneOrEmpty, findPagedList, findSet, findSingleAttribute, findSingleAttributeList, findSingleAttributeOrEmpty, findSingleAttributeSet, findStream, findVersions, findVersionsBetween, forUpdate, forUpdateNoWait, forUpdateSkipLocked, getBeanType, getGeneratedSql, orderBy, orderById, setAllowLoadErrors, setAutoTune, setBaseTable, setBeanCacheMode, setBufferFetchSizeHint, setCountDistinct, setDisableLazyLoading, setDistinct, setFirstRow, setHint, setIncludeSoftDeletes, setLabel, setLazyLoadBatchSize, setMapKey, setMaxRows, setOrderBy, setPaging, setPersistenceContextScope, setRawSql, setTimeout, setUnmodifiable, setUseCache, setUseQueryCache, setUseQueryCache, usingConnection, usingDatabase, usingMaster, usingTransaction, validate, withLock, withLockMethods inherited from interface io.ebean.QueryBuilderProjection
apply, distinctOn, fetch, fetch, fetch, fetch, fetchCache, fetchCache, fetchLazy, fetchLazy, fetchQuery, fetchQuery, select, selectMethods inherited from interface io.ebeaninternal.api.SpiCancelableQuery
checkCancelled, setCancelableQueryMethods inherited from interface io.ebeaninternal.api.SpiQueryFetch
addNested, fetchProperties, selectProperties
-
Method Details
-
profileEventId
String profileEventId()Return the profile event id based on query mode and type. -
profileId
String profileId()Return the id used to identify a particular query for the given bean type. -
profileLocation
ProfileLocation profileLocation()Return the profile location for this query. -
hint
String hint()Return the SQL hint to include in the query. -
label
String label()Return the label set on the query. -
planLabel
String planLabel()Return the label manually set on the query or from the profile location. -
transaction
SpiTransaction transaction()Return the transaction explicitly assigned or null. -
isUseMaster
boolean isUseMaster()Return true if this query should not use the read only data source. -
isFindById
boolean isFindById()Return true if this is a "find by id" query. This includes a check for a single "equal to" expression for the Id. -
isFindAll
boolean isFindAll()Return true if this is a "find all" query. Used to set a "find all" profile location if necessary. -
isAutoTunable
boolean isAutoTunable()Return true if AutoTune should be attempted on this query. -
isNativeSql
boolean isNativeSql()Return true if this is a native sql query. -
nativeSql
String nativeSql()Return the unmodified native sql query (with named params etc). -
getForUpdateLockWait
Query.LockWait getForUpdateLockWait()Return the ForUpdate mode.- Specified by:
getForUpdateLockWaitin interfaceQuery<T>
-
descriptor
BeanDescriptor<T> descriptor()Return the bean descriptor for this query. -
queryPlanKey
Object queryPlanKey()Return the query plan key. -
rawSql
SpiRawSql rawSql()Return the RawSql that was set to use for this query. -
persistenceContextScope
PersistenceContextScope persistenceContextScope()Return the PersistenceContextScope that this query should use.This can be null and in that case use the default scope.
-
getOriginKey
String getOriginKey()Return the origin key. -
lazyLoadBatchSize
int lazyLoadBatchSize()Return the default lazy load batch size. -
selectAllForLazyLoadProperty
void selectAllForLazyLoadProperty()Return true if select all properties was used to ensure the property invoking a lazy load was included in the query. -
selectProperties
Set the select properties. -
fetchProperties
Set the fetch properties for the given path. -
setProfilePath
Set the on a secondary query given the label, relativePath and profile location of the parent query. -
setMode
Set the query mode. -
mode
SpiQuery.Mode mode()Return the query mode. -
temporalMode
SpiQuery.TemporalMode temporalMode()Return the Temporal mode for the query. -
isVersionsBetween
boolean isVersionsBetween()Return true if this is a find versions between query. -
versionStart
Timestamp versionStart()Return the find versions start timestamp. -
versionEnd
Timestamp versionEnd()Return the find versions end timestamp. -
isAsOfQuery
boolean isAsOfQuery()Return true if this is a 'As Of' query. -
isIncludeSoftDeletes
boolean isIncludeSoftDeletes()Return true if this query includes soft deleted rows. -
getAsOf
Timestamp getAsOf()Return the asOf Timestamp which the query should run as. -
isAsOfBaseTable
boolean isAsOfBaseTable()Return true if the base table is using history. -
setAsOfBaseTable
void setAsOfBaseTable()Set when the base table is using history. -
incrementAsOfTableCount
void incrementAsOfTableCount()Increment the counter of tables used in 'As Of' query. -
incrementAsOfTableCount
void incrementAsOfTableCount(int asOfTableCount) Increment the counter of tables used in 'As Of' query. -
getAsOfTableCount
int getAsOfTableCount()Return the table alias used for the base table. -
addSoftDeletePredicate
-
softDeletePredicates
-
setArrayParameter
Bind the named multi-value array parameter which we would use with Postgres ANY. -
copy
Return a copy of the query.Note that this does NOT copy the forUpdate property. See #2762.
- Specified by:
copyin interfaceQueryBuilder<Query<T>,T>
-
distinctOn
String distinctOn()Return the distinct on clause. -
copy
Return a copy of the query attaching to a different EbeanServer. -
type
SpiQuery.Type type()Return the type of query (List, Set, Map, Bean, rowCount etc). -
setType
Set the query type (List, Set etc). -
loadDescription
String loadDescription()Return a more detailed description of the lazy or query load. -
loadMode
String loadMode()Return the load mode (+lazy or +query). -
setLazyLoadForParents
This becomes a lazy loading query for a many relationship. -
lazyLoadMany
BeanPropertyAssocMany<?> lazyLoadMany()Return the lazy loading 'many' property. -
setLoadDescription
Set the load mode (+lazy or +query) and the load description. -
checkNamedParameters
void checkNamedParameters()Check that the named parameters have had their values set. -
createNamedParameter
Create a named parameter placeholder. -
manyWhereJoins
ManyWhereJoins manyWhereJoins()Return the joins required to support predicates on the many properties. -
resetBeanCacheAutoMode
void resetBeanCacheAutoMode(boolean findOne) Reset AUTO mode to OFF for findList(). Expect explicit cache use with findList(). -
cacheIdLookup
CacheIdLookup<T> cacheIdLookup()Bean cache lookup for find by ids. -
naturalKey
NaturalKeyQueryData<T> naturalKey()Collect natural key data for this query or null if the query does not match the requirements of natural key lookup. -
naturalKeyBindParam
NaturalKeyBindParam naturalKeyBindParam()Return a Natural Key bind parameter if supported by this query. -
setupForDeleteOrUpdate
void setupForDeleteOrUpdate()Set the query to be a delete query. -
setDeleteByIdsPlan
CQueryPlanKey setDeleteByIdsPlan()Set the query to be delete by ids due to cascading delete. -
setSelectId
void setSelectId()Set the query to select the id property only. -
setSingleAttribute
void setSingleAttribute()Mark the query as selecting a single attribute. -
isSingleAttribute
boolean isSingleAttribute()Return true if this is singleAttribute query. -
isWithId
boolean isWithId()Return true if the query should include the Id property.distinct and single attribute queries exclude the Id property.
-
setFilterMany
Set a filter to a join path. -
setTenantId
Set the tenantId to use for lazy loading. -
tenantId
Object tenantId()Return the tenantId to use for lazy loading. -
setLazyLoadManyPath
Set the path of the many when +query/+lazy loading query is executed. -
convertJoins
SpiQueryManyJoin convertJoins()Convert joins as necessary to query joins etc. -
secondaryQuery
SpiQuerySecondary secondaryQuery()Return secondary queries if required. -
persistenceContext
PersistenceContext persistenceContext()Return the TransactionContext.If no TransactionContext is present on the query then the TransactionContext from the Transaction is used (transaction scoped persistence context).
-
setPersistenceContext
Set an explicit TransactionContext (typically for a refresh query).If no TransactionContext is present on the query then the TransactionContext from the Transaction is used (transaction scoped persistence context).
-
isDetailEmpty
boolean isDetailEmpty()Return true if the query detail has neither select or joins specified. -
isAutoTune
Boolean isAutoTune()Return explicit AutoTune setting or null. If null then not explicitly set so we use the default behaviour. -
profilingListener
ProfilingListener profilingListener()If return null then no profiling for this query. If a ProfilingListener is returned this implies that profiling is turned on for this query (and all the objects this query creates). -
setProfilingListener
This has the effect of turning on profiling for this query. -
setOrigin
Return the origin point for the query.This MUST be call prior to a query being changed via tuning. This is because the queryPlanHash is used to identify the query point.
-
setParentNode
Set the profile point of the bean or collection that is lazy loading.This enables use to hook this back to the original 'root' query by the queryPlanHash and stackPoint.
-
setLazyLoadProperty
Set the property that invoked the lazy load and MUST be included in the lazy loading query. -
lazyLoadProperty
String lazyLoadProperty()Return the property that invoked lazy load. -
parentNode
ObjectGraphNode parentNode()Used to hook back a lazy loading query to the original query (query point).This will return null or an "original" query.
-
usingFuture
void usingFuture()Set that this is a future query that will execute in the background. -
isUsingFuture
boolean isUsingFuture()Return true if this is a future query. -
isUsageProfiling
boolean isUsageProfiling()Return false when this is a lazy load or refresh query for a bean.We just take/copy the data from those beans and don't collect AutoTune usage profiling on those lazy load or refresh beans.
-
setUsageProfiling
void setUsageProfiling(boolean usageProfiling) Set to false if this query should not be included in the AutoTune usage profiling information. -
prepare
Prepare the query which prepares sub-query expressions and calculates and returns the query plan key.The query plan excludes actual bind values (as they don't effect the query plan).
-
queryBindKey
Build the key for the bind values used in the query (for l2 query cache).Combined with queryPlanHash() to return queryHash (a unique key for a query).
-
queryHash
HashQuery queryHash()Identifies queries that are exactly the same including bind variables. -
isRawSql
boolean isRawSql()Return true if this is a RawSql query. -
checkPagingOrderBy
boolean checkPagingOrderBy()Return true if the query should have an order by appended automatically. -
orderByIsEmpty
boolean orderByIsEmpty()Return true if there is no Order By clause. -
getOrderBy
Return the Order By clause or null if there is none defined. -
whereExpressions
SpiExpressionList<T> whereExpressions()Can return null if no expressions where added to the where clause. -
havingExpressions
SpiExpressionList<T> havingExpressions()Can return null if no expressions where added to the having clause. -
hasMaxRowsOrFirstRow
boolean hasMaxRowsOrFirstRow()Returns true if either firstRow or maxRows has been set. -
isBeanCacheGet
boolean isBeanCacheGet()Return true if the query should GET against bean cache. -
isBeanCachePut
boolean isBeanCachePut()Return true if the query should PUT against the bean cache. -
isForceHitDatabase
boolean isForceHitDatabase()Return true if we must hit the DB (Cache reload or select for update). -
beanCacheMode
CacheMode beanCacheMode()Return the cache mode for using the bean cache (Get and Put). -
queryCacheMode
CacheMode queryCacheMode()Return the cache mode if this query should use/check the query cache. -
isUnmodifiable
boolean isUnmodifiable()Return true if the beans returned by this query should be unmodifiable. -
timeout
int timeout()Return the query timeout. -
bindParams
BindParams bindParams()Return the bind parameters. -
initBindParams
BindParams initBindParams()Return the bind parameters ensuring it is initialised. -
setDetail
Replace the query detail. This is used by the AutoTune feature to as a fast way to set the query properties and joins.Note care must be taken to keep the where, orderBy, firstRows and maxRows held in the detail attributes.
-
tuneFetchProperties
AutoTune tune the detail specifying properties to select on already defined joins and adding extra joins where they are missing. -
setAutoTuned
void setAutoTuned(boolean autoTuned) Set to true if this query has been tuned by autoTune. -
detail
OrmQueryDetail detail()Return the query detail. -
m2mIncludeJoin
TableJoin m2mIncludeJoin()Return the extra join for a M2M lazy load. -
setM2MIncludeJoin
Set the extra join for a M2M lazy load. -
mapKey
String mapKey()Return the property used to specify keys for a map. -
getMaxRows
int getMaxRows()Return the maximum number of rows to return in the query.- Specified by:
getMaxRowsin interfaceQuery<T>
-
getFirstRow
int getFirstRow()Return the index of the first row to return in the query.- Specified by:
getFirstRowin interfaceQuery<T>
-
isDisableLazyLoading
boolean isDisableLazyLoading()Return true if lazy loading has been disabled on the query. -
isDistinct
boolean isDistinct()Return true if this query has been specified by a user to use DISTINCT. -
isManualId
boolean isManualId()Return true if the Id property is manually included in the query (DTO queries). -
setManualId
void setManualId()Set to true when we only include the Id property if it is explicitly included in the select(). -
setDefaultSelectClause
void setDefaultSelectClause()Set default select clauses where none have been explicitly defined. -
setGeneratedSql
Set the generated sql for debug purposes. -
setDefaultFetchBuffer
void setDefaultFetchBuffer(int fetchSize) Set the JDBC fetchSize buffer hint if not explicitly set. -
bufferFetchSizeHint
int bufferFetchSizeHint()Return the hint for Statement.setFetchSize(). -
baseTable
String baseTable()Return the base table to use if user defined on the query. -
alias
String alias()Return root table alias set byQueryBuilder.alias(String)command. -
getAlias
Return root table alias with default option. -
validate
Validate the query returning the set of properties with unknown paths. -
updateProperties
OrmUpdateProperties updateProperties()Return the properties for an update query. -
simplifyExpressions
void simplifyExpressions()Simplify nested expression lists where possible. -
countDistinctOrder
CountDistinctOrder countDistinctOrder()Returns the count distinct order setting. -
handleLoadError
Handles load errors.
-