java.lang.Object
io.ebeaninternal.server.core.BeanRequest
io.ebeaninternal.server.core.OrmQueryRequest<T>
- All Implemented Interfaces:
BeanQueryRequest<T>,SpiOrmQueryRequest<T>
Wraps the objects involved in executing a Query.
-
Field Summary
Fields inherited from class io.ebeaninternal.server.core.BeanRequest
createdTransaction, server, transaction -
Constructor Summary
ConstructorsConstructorDescriptionOrmQueryRequest(SpiEbeanServer server, OrmQueryEngine queryEngine, SpiQuery<T> query, SpiTransaction t) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDependentTables(Set<String> tables) Return the base table alias for this query.Return the bean cache hits (when all hits / no misses).Return the bean cache hits for findMap (when all hits / no misses).Return the bean cache hits for findMap (when all hits / no misses).voiddbLikeClause(boolean rawLikeExpression) Return the database platform like clause.intdelete()Execute the query as a delete.Return the BeanDescriptor for the associated bean.Determine and return the ToMany property that is included in the query.voidWill end a locally created transaction.escapeLikeString(String value) Return the database platform escaped like string.voidexecuteSecondaryQueries(boolean forEach) intExecute the find row count query.voidExecute findEach with a batch consumer.voidExecute findEach iterating results one bean at a time.voidfindEachWhile(Predicate<T> consumer) Execute the find returning a QueryIterator and visitor pattern.finder()Return a bean specific finder if one has been set.findId()Execute the query as findById.<A> List<A> findIds()Execute the find ids query.Execute the find returning a QueryIterator.findList()Execute the query as findList.findMap()Execute the query as findMap.Execute returning the ResultSet.findSet()Execute the query as findSet.<A extends Collection<?>>
AfindSingleAttributeCollection(A collection) Execute the findSingleAttributeCollection query.Execute the finVersions() query.intbooleanMaybe hit the bean cache returning true if everything was obtained from the cache (that there were no misses).Try to get the query result from the query cache.voidThis will create a local (readOnly) transaction if no current transaction exists.booleanbooleanbooleanReturn true if delete by statement is allowed for this type given cascade rules etc.booleanReturn true if this is a find by id (rather than List Set or Map).booleanReturn true if this is a findEach, findIterate type query where we expect many results.booleanReturn true if hitting bean cache and returning all beans from cache.booleanbooleanReturn true if no MaxRows or use LIMIT in SQL update.booleanbooleanisMultiValueSupported(Class<?> valueType) booleanbooleanbooleanbooleanisRawSql()intReturn the batch size for lazy loading on this bean query request.Return the graph context for this query.voidLog the SQL if the logLevel is appropriate.Return the many property that is fetched in the query or null if there is not one.voidMark the transaction as not being query only.voidmergeCacheHits(BeanCollection<T> result) Merge in prior L2 bean cache hits with the query result.Return the PersistenceContext used for this request.voidPrepare the query and calculate the query plan key.voidputQueryPlan(CQueryPlan queryPlan) Put the QueryPlan into the cache.voidputToQueryCache(Object result) query()Return the query.Return a queryPlan for the current query if one exists.Return the queryPlanHash.voidresetBeanCacheAutoMode(boolean findOne) Reset Bean cache mode AUTO - require explicit setting for bean cache use with findList().voidRollback the transaction if it was created for this request.intFor use with QueryIterator and secondary queries this returns the minimum batch size that should be loaded before executing the secondary queries.voidsetCancelableQuery(CancelableQuery cancelableQuery) Set a Query object that owns the PreparedStatement that can be cancelled.voidsetDefaultFetchBuffer(int fetchSize) Set the JDBC buffer fetchSize hint if not set explicitly.voidvoidslowQueryCheck(long executionTimeMicros, int rowCount) Check for slow query event.tenantId()Return the tenantId associated with this request.jakarta.persistence.PersistenceExceptiontranslate(String bindLog, String sql, SQLException e) intupdate()Execute the query as a update.Methods inherited from class io.ebeaninternal.server.core.BeanRequest
clearTransIfRequired, commitTransIfRequired, createImplicitTransIfRequired, database, dataTimeZone, logSql, logSummary, server, transaction, transactionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.ebean.event.BeanQueryRequest
database, transaction
-
Constructor Details
-
OrmQueryRequest
public OrmQueryRequest(SpiEbeanServer server, OrmQueryEngine queryEngine, SpiQuery<T> query, SpiTransaction t)
-
-
Method Details
-
translate
public jakarta.persistence.PersistenceException translate(String bindLog, String sql, SQLException e) -
isGetAllFromBeanCache
public boolean isGetAllFromBeanCache()Description copied from interface:SpiOrmQueryRequestReturn true if hitting bean cache and returning all beans from cache.- Specified by:
isGetAllFromBeanCachein interfaceSpiOrmQueryRequest<T>
-
isDeleteByStatement
public boolean isDeleteByStatement()Description copied from interface:SpiOrmQueryRequestReturn true if delete by statement is allowed for this type given cascade rules etc.- Specified by:
isDeleteByStatementin interfaceSpiOrmQueryRequest<T>
-
isPadInExpression
public boolean isPadInExpression()- Specified by:
isPadInExpressionin interfaceBeanQueryRequest<T>
-
isMultiValueIdSupported
public boolean isMultiValueIdSupported()- Specified by:
isMultiValueIdSupportedin interfaceBeanQueryRequest<T>
-
isMultiValueSupported
- Specified by:
isMultiValueSupportedin interfaceBeanQueryRequest<T>
-
markNotQueryOnly
public void markNotQueryOnly()Mark the transaction as not being query only.- Specified by:
markNotQueryOnlyin interfaceSpiOrmQueryRequest<T>
-
dbLikeClause
Return the database platform like clause.- Specified by:
dbLikeClausein interfaceSpiOrmQueryRequest<T>
-
escapeLikeString
Return the database platform escaped like string.- Specified by:
escapeLikeStringin interfaceSpiOrmQueryRequest<T>
-
executeSecondaryQueries
public void executeSecondaryQueries(boolean forEach) -
secondaryQueriesMinBatchSize
public int secondaryQueriesMinBatchSize()For use with QueryIterator and secondary queries this returns the minimum batch size that should be loaded before executing the secondary queries.If -1 is returned then NO secondary queries are registered and simple iteration is fine.
-
descriptor
Return the BeanDescriptor for the associated bean.- Specified by:
descriptorin interfaceSpiOrmQueryRequest<T>
-
loadContext
Return the graph context for this query. -
prepareQuery
public void prepareQuery()Prepare the query and calculate the query plan key.- Specified by:
prepareQueryin interfaceSpiOrmQueryRequest<T>
-
isNativeSql
public boolean isNativeSql() -
isRawSql
public boolean isRawSql() -
createDeployParser
-
persistenceContext
Return the PersistenceContext used for this request. -
initTransIfRequired
public void initTransIfRequired()This will create a local (readOnly) transaction if no current transaction exists.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.
- Specified by:
initTransIfRequiredin interfaceSpiOrmQueryRequest<T>
-
rollbackTransIfRequired
public void rollbackTransIfRequired()Rollback the transaction if it was created for this request.- Overrides:
rollbackTransIfRequiredin classBeanRequest
-
endTransIfRequired
public void endTransIfRequired()Will end a locally created transaction.It ends the query only transaction.
- Specified by:
endTransIfRequiredin interfaceSpiOrmQueryRequest<T>
-
isFindById
public boolean isFindById()Return true if this is a find by id (rather than List Set or Map). -
isFindIterate
public boolean isFindIterate()Return true if this is a findEach, findIterate type query where we expect many results. -
delete
public int delete()Description copied from interface:SpiOrmQueryRequestExecute the query as a delete.- Specified by:
deletein interfaceSpiOrmQueryRequest<T>
-
update
public int update()Description copied from interface:SpiOrmQueryRequestExecute the query as a update.- Specified by:
updatein interfaceSpiOrmQueryRequest<T>
-
findResultSet
Description copied from interface:SpiOrmQueryRequestExecute returning the ResultSet.- Specified by:
findResultSetin interfaceSpiOrmQueryRequest<T>
-
findId
Description copied from interface:SpiOrmQueryRequestExecute the query as findById.- Specified by:
findIdin interfaceSpiOrmQueryRequest<T>
-
findCount
public int findCount()Description copied from interface:SpiOrmQueryRequestExecute the find row count query.- Specified by:
findCountin interfaceSpiOrmQueryRequest<T>
-
findIds
Description copied from interface:SpiOrmQueryRequestExecute the find ids query.- Specified by:
findIdsin interfaceSpiOrmQueryRequest<T>
-
findEach
Description copied from interface:SpiOrmQueryRequestExecute findEach iterating results one bean at a time.- Specified by:
findEachin interfaceSpiOrmQueryRequest<T>
-
findEach
Description copied from interface:SpiOrmQueryRequestExecute findEach with a batch consumer.- Specified by:
findEachin interfaceSpiOrmQueryRequest<T>
-
findEachWhile
Description copied from interface:SpiOrmQueryRequestExecute the find returning a QueryIterator and visitor pattern.- Specified by:
findEachWhilein interfaceSpiOrmQueryRequest<T>
-
findIterate
Description copied from interface:SpiOrmQueryRequestExecute the find returning a QueryIterator.- Specified by:
findIteratein interfaceSpiOrmQueryRequest<T>
-
findList
Description copied from interface:SpiOrmQueryRequestExecute the query as findList.- Specified by:
findListin interfaceSpiOrmQueryRequest<T>
-
findVersions
Description copied from interface:SpiOrmQueryRequestExecute the finVersions() query.- Specified by:
findVersionsin interfaceSpiOrmQueryRequest<T>
-
findSet
Description copied from interface:SpiOrmQueryRequestExecute the query as findSet.- Specified by:
findSetin interfaceSpiOrmQueryRequest<T>
-
findMap
Description copied from interface:SpiOrmQueryRequestExecute the query as findMap.- Specified by:
findMapin interfaceSpiOrmQueryRequest<T>
-
findSingleAttributeCollection
Description copied from interface:SpiOrmQueryRequestExecute the findSingleAttributeCollection query.- Specified by:
findSingleAttributeCollectionin interfaceSpiOrmQueryRequest<T>
-
finder
Return a bean specific finder if one has been set. -
query
Description copied from interface:SpiOrmQueryRequestReturn the query.- Specified by:
queryin interfaceBeanQueryRequest<T>- Specified by:
queryin interfaceSpiOrmQueryRequest<T>
-
determineMany
Determine and return the ToMany property that is included in the query. -
manyPropertyForOrderBy
Return the many property that is fetched in the query or null if there is not one. -
queryPlan
Return a queryPlan for the current query if one exists. Returns null if no query plan for this query exists. -
queryPlanKey
Return the queryPlanHash.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.
-
putQueryPlan
Put the QueryPlan into the cache. -
resetBeanCacheAutoMode
public void resetBeanCacheAutoMode(boolean findOne) Description copied from interface:SpiOrmQueryRequestReset Bean cache mode AUTO - require explicit setting for bean cache use with findList().- Specified by:
resetBeanCacheAutoModein interfaceSpiOrmQueryRequest<T>
-
isQueryCachePut
public boolean isQueryCachePut() -
isBeanCachePutMany
public boolean isBeanCachePutMany() -
isBeanCachePut
public boolean isBeanCachePut() -
mergeCacheHits
Merge in prior L2 bean cache hits with the query result. -
beanCacheHits
Description copied from interface:SpiOrmQueryRequestReturn the bean cache hits (when all hits / no misses).- Specified by:
beanCacheHitsin interfaceSpiOrmQueryRequest<T>
-
beanCacheHitsAsMap
Description copied from interface:SpiOrmQueryRequestReturn the bean cache hits for findMap (when all hits / no misses).- Specified by:
beanCacheHitsAsMapin interfaceSpiOrmQueryRequest<T>
-
beanCacheHitsAsSet
Description copied from interface:SpiOrmQueryRequestReturn the bean cache hits for findMap (when all hits / no misses).- Specified by:
beanCacheHitsAsSetin interfaceSpiOrmQueryRequest<T>
-
getFromBeanCache
public boolean getFromBeanCache()Description copied from interface:SpiOrmQueryRequestMaybe hit the bean cache returning true if everything was obtained from the cache (that there were no misses).Do this for findList() on many natural keys or many Ids.
- Specified by:
getFromBeanCachein interfaceSpiOrmQueryRequest<T>
-
getFromQueryCache
Try to get the query result from the query cache.- Specified by:
getFromQueryCachein interfaceSpiOrmQueryRequest<T>
-
putToQueryCache
-
setCancelableQuery
Set a Query object that owns the PreparedStatement that can be cancelled. -
logSql
Log the SQL if the logLevel is appropriate. -
lazyLoadBatchSize
public int lazyLoadBatchSize()Return the batch size for lazy loading on this bean query request. -
baseTableAlias
Return the base table alias for this query. -
setDefaultFetchBuffer
public void setDefaultFetchBuffer(int fetchSize) Set the JDBC buffer fetchSize hint if not set explicitly. -
tenantId
Return the tenantId associated with this request. -
slowQueryCheck
public void slowQueryCheck(long executionTimeMicros, int rowCount) Check for slow query event. -
setInlineCountDistinct
public void setInlineCountDistinct() -
isInlineCountDistinct
public boolean isInlineCountDistinct() -
addDependentTables
-
isInlineSqlUpdateLimit
public boolean isInlineSqlUpdateLimit()Return true if no MaxRows or use LIMIT in SQL update. -
forwardOnlyFetchSize
public int forwardOnlyFetchSize() -
clearContext
public void clearContext()
-