Class DefaultSqlPreparedQuery<E,R>
- java.lang.Object
-
- io.micronaut.data.runtime.operations.internal.query.DefaultBindableParametersPreparedQuery<E,R>
-
- io.micronaut.data.runtime.operations.internal.sql.DefaultSqlPreparedQuery<E,R>
-
- Type Parameters:
E- The entity typeR- The result type
- All Implemented Interfaces:
io.micronaut.core.annotation.AnnotationMetadataProvider,io.micronaut.core.annotation.AnnotationSource,io.micronaut.core.attr.AttributeHolder,io.micronaut.core.naming.Named,PagedQuery<E>,PreparedDataOperation<R>,PreparedQuery<E,R>,StoredDataOperation<R>,StoredQuery<E,R>,BindableParametersPreparedQuery<E,R>,BindableParametersStoredQuery<E,R>,PersistentEntityAwareQuery<E>,SqlPreparedQuery<E,R>,SqlStoredQuery<E,R>,DelegatePreparedQuery<E,R>,DelegateStoredQuery<E,R>
@Internal public class DefaultSqlPreparedQuery<E,R> extends DefaultBindableParametersPreparedQuery<E,R> implements SqlPreparedQuery<E,R>, DelegatePreparedQuery<E,R>
Implementation ofSqlPreparedQuery.- Since:
- 3.5.0
- Author:
- Denis Stepanov
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.micronaut.data.runtime.operations.internal.query.BindableParametersStoredQuery
BindableParametersStoredQuery.Binder
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Stringqueryprotected SqlStoredQuery<E,R>sqlStoredQuery-
Fields inherited from class io.micronaut.data.runtime.operations.internal.query.DefaultBindableParametersPreparedQuery
invocationContext, preparedQuery, storedQuery
-
-
Constructor Summary
Constructors Constructor Description DefaultSqlPreparedQuery(PreparedQuery<E,R> preparedQuery)DefaultSqlPreparedQuery(PreparedQuery<E,R> preparedQuery, SqlStoredQuery<E,R> sqlStoredQuery)DefaultSqlPreparedQuery(SqlStoredQuery<E,R> sqlStoredQuery)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidattachPageable(Pageable pageable, boolean isSingleResult)Modify the query according to the pageable.java.util.Map<QueryParameterBinding,java.lang.Object>collectAutoPopulatedPreviousValues(E entity)Collect auto-populated property values before pre-actions are triggered and property values are modified.DialectgetDialect()Get dialect.RuntimePersistentEntity<E>getPersistentEntity()PreparedQuery<E,R>getPreparedQueryDelegate()java.lang.StringgetQuery()The query to execute.SqlQueryBuildergetQueryBuilder()protected intgetQueryParameterValueSize(QueryParameterBinding parameter)Gets number of parameter values for the query parameter binding (used for IN for example).booleanisExpandableQuery()voidprepare(E entity)Check if query need to be modified to expand parameters.protected intsizeOf(java.lang.Object value)Compute the size of the given object.-
Methods inherited from class io.micronaut.data.runtime.operations.internal.query.DefaultBindableParametersPreparedQuery
bindParameters, bindParameters
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataProvider
findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByType
-
Methods inherited from interface io.micronaut.core.annotation.AnnotationSource
getAnnotation, getAnnotation, getDeclaredAnnotation, getDeclaredAnnotation, isAnnotationPresent, isDeclaredAnnotationPresent, synthesize, synthesizeDeclared
-
Methods inherited from interface io.micronaut.data.runtime.operations.internal.query.BindableParametersPreparedQuery
bindParameters, bindParameters
-
Methods inherited from interface io.micronaut.data.runtime.operations.internal.query.BindableParametersStoredQuery
bindParameters
-
Methods inherited from interface io.micronaut.data.runtime.query.internal.DelegatePreparedQuery
getArguments, getAttribute, getAttribute, getAttributes, getPageable, getParameterArray, getParameterInRole, getParameterValues, getQueryHints, getRepositoryType, getRootEntity, getStoredQueryDelegate, isDtoProjection, isRawQuery
-
Methods inherited from interface io.micronaut.data.runtime.query.internal.DelegateStoredQuery
getAnnotationMetadata, getArgumentTypes, getEntityIdentifierType, getExpandableQueryParts, getIndexedParameterAutoPopulatedPreviousPropertyIndexes, getIndexedParameterAutoPopulatedPreviousPropertyPaths, getIndexedParameterAutoPopulatedPropertyPaths, getJoinFetchPaths, getName, getQueryBindings, getResultArgument, getResultDataType, getResultType, getTransactionDefinition, hasInExpression, hasPageable, hasResultConsumer, isCount, isNative, isOptimisticLock, isSingleResult, useNumericPlaceholders
-
Methods inherited from interface io.micronaut.data.model.runtime.PreparedQuery
getLastUpdatedType
-
Methods inherited from interface io.micronaut.data.model.runtime.StoredQuery
getIndexedParameterBinding, getIndexedParameterPaths, getIndexedParameterTypes, getLastUpdatedProperty, getParameterBinding, getParameterNames
-
-
-
-
Field Detail
-
sqlStoredQuery
protected final SqlStoredQuery<E,R> sqlStoredQuery
-
query
protected java.lang.String query
-
-
Constructor Detail
-
DefaultSqlPreparedQuery
public DefaultSqlPreparedQuery(PreparedQuery<E,R> preparedQuery)
-
DefaultSqlPreparedQuery
public DefaultSqlPreparedQuery(PreparedQuery<E,R> preparedQuery, SqlStoredQuery<E,R> sqlStoredQuery)
-
DefaultSqlPreparedQuery
public DefaultSqlPreparedQuery(SqlStoredQuery<E,R> sqlStoredQuery)
-
-
Method Detail
-
getPersistentEntity
public RuntimePersistentEntity<E> getPersistentEntity()
- Specified by:
getPersistentEntityin interfacePersistentEntityAwareQuery<E>- Overrides:
getPersistentEntityin classDefaultBindableParametersPreparedQuery<E,R>- Returns:
- The persistent entity
-
getPreparedQueryDelegate
public PreparedQuery<E,R> getPreparedQueryDelegate()
- Specified by:
getPreparedQueryDelegatein interfaceDelegatePreparedQuery<E,R>- Overrides:
getPreparedQueryDelegatein classDefaultBindableParametersPreparedQuery<E,R>- Returns:
- The delegate
-
isExpandableQuery
public boolean isExpandableQuery()
- Specified by:
isExpandableQueryin interfaceSqlStoredQuery<E,R>- Returns:
- true if query is expandable
-
getDialect
public Dialect getDialect()
Description copied from interface:SqlStoredQueryGet dialect.- Specified by:
getDialectin interfaceSqlStoredQuery<E,R>- Returns:
- dialect
-
getQueryBuilder
public SqlQueryBuilder getQueryBuilder()
- Specified by:
getQueryBuilderin interfaceSqlStoredQuery<E,R>- Returns:
- query builder for possible modification in the prepared query
-
getQuery
public java.lang.String getQuery()
Description copied from interface:StoredQueryThe query to execute.- Specified by:
getQueryin interfaceDelegatePreparedQuery<E,R>- Specified by:
getQueryin interfaceDelegateStoredQuery<E,R>- Specified by:
getQueryin interfaceStoredQuery<E,R>- Returns:
- The query to execute
-
collectAutoPopulatedPreviousValues
public java.util.Map<QueryParameterBinding,java.lang.Object> collectAutoPopulatedPreviousValues(E entity)
Description copied from interface:SqlStoredQueryCollect auto-populated property values before pre-actions are triggered and property values are modified.- Specified by:
collectAutoPopulatedPreviousValuesin interfaceSqlStoredQuery<E,R>- Parameters:
entity- The entity instance- Returns:
- collected values
-
prepare
public void prepare(E entity)
Check if query need to be modified to expand parameters.- Specified by:
preparein interfaceSqlPreparedQuery<E,R>- Parameters:
entity- The entity instance
-
getQueryParameterValueSize
protected int getQueryParameterValueSize(QueryParameterBinding parameter)
Gets number of parameter values for the query parameter binding (used for IN for example).- Parameters:
parameter- the query binding parameter- Returns:
- number of parameter values in query parameter binding
-
attachPageable
public void attachPageable(Pageable pageable, boolean isSingleResult)
Description copied from interface:SqlPreparedQueryModify the query according to the pageable.- Specified by:
attachPageablein interfaceSqlPreparedQuery<E,R>- Parameters:
pageable- The pageableisSingleResult- is single result
-
sizeOf
protected int sizeOf(java.lang.Object value)
Compute the size of the given object.- Parameters:
value- The value- Returns:
- The size
-
-