Package io.micronaut.data.model.runtime
Interface StoredQuery<E,R>
-
- Type Parameters:
E
- The entity typeR
- The result type
- All Superinterfaces:
io.micronaut.core.annotation.AnnotationMetadataProvider
,io.micronaut.core.annotation.AnnotationSource
,io.micronaut.core.naming.Named
,StoredDataOperation<R>
- All Known Subinterfaces:
BindableParametersPreparedQuery<E,R>
,BindableParametersStoredQuery<E,R>
,DelegatePreparedQuery<E,R>
,DelegateStoredQuery<E,R>
,MongoPreparedQuery<E,R>
,MongoStoredQuery<E,R>
,PreparedQuery<E,R>
,SqlPreparedQuery<E,R>
,SqlStoredQuery<E,R>
- All Known Implementing Classes:
BasicStoredQuery
,DefaultBindableParametersPreparedQuery
,DefaultBindableParametersStoredQuery
,DefaultPreparedQuery
,DefaultSqlPreparedQuery
,DefaultSqlStoredQuery
,DefaultStoredQuery
,DummyPreparedQuery
,QueryResultStoredQuery
public interface StoredQuery<E,R> extends io.micronaut.core.naming.Named, StoredDataOperation<R>
A stored computed query. This interface represents the- Since:
- 1.0.0
- Author:
- graemerocher
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default java.lang.Class<?>[]
getArgumentTypes()
The argument types to the method that invokes the query.default java.util.Optional<java.lang.Class<?>>
getEntityIdentifierType()
The type of the ID member of the entity.java.lang.String[]
getExpandableQueryParts()
The query to execute.default int[]
getIndexedParameterAutoPopulatedPreviousPropertyIndexes()
Deprecated.default java.lang.String[]
getIndexedParameterAutoPopulatedPreviousPropertyPaths()
Deprecated.default java.lang.String[]
getIndexedParameterAutoPopulatedPropertyPaths()
Deprecated.default int[]
getIndexedParameterBinding()
Deprecated.default java.lang.String[]
getIndexedParameterPaths()
Deprecated.default DataType[]
getIndexedParameterTypes()
Deprecated.default java.util.Set<JoinPath>
getJoinFetchPaths()
default java.lang.String
getLastUpdatedProperty()
Deprecated.default java.util.Map<java.lang.String,java.lang.String>
getParameterBinding()
Deprecated.default java.lang.String[]
getParameterNames()
Deprecated.java.lang.String
getQuery()
The query to execute.java.util.List<QueryParameterBinding>
getQueryBindings()
The list of query bindings.default java.util.Map<java.lang.String,java.lang.Object>
getQueryHints()
The parameter binding.io.micronaut.core.type.Argument<R>
getResultArgument()
The query result type.DataType
getResultDataType()
java.lang.Class<R>
getResultType()
The query result type.java.lang.Class<E>
getRootEntity()
The root entity type.default boolean
hasInExpression()
Deprecated.boolean
hasPageable()
Does the query have a pageable.boolean
hasResultConsumer()
boolean
isCount()
default boolean
isDtoProjection()
Returns whether the query returns the actual entity or a Data Transfer Object (DTO) project.default boolean
isNative()
In cases where one needs to differentiate between at higher level query format (like JPA-QL) and a lower level format (like SQL).default boolean
isOptimisticLock()
Is with an optimistic lock.boolean
isRawQuery()
Gets an indicator telling whether underlying query is raw query.boolean
isSingleResult()
Whether the query can be treated as a single result.boolean
useNumericPlaceholders()
Are the placeholders for query set using numeric indices starting from 1.-
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataProvider
findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, getAnnotationMetadata, 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.model.runtime.StoredDataOperation
getTransactionDefinition
-
-
-
-
Method Detail
-
getRootEntity
@NonNull java.lang.Class<E> getRootEntity()
The root entity type.- Returns:
- The root entity type
-
hasInExpression
@Deprecated default boolean hasInExpression()
Deprecated.Does the query contain an in expression.- Returns:
- True if it does
-
hasPageable
boolean hasPageable()
Does the query have a pageable.- Returns:
- True if it does
-
getQuery
@NonNull java.lang.String getQuery()
The query to execute.- Returns:
- The query to execute
-
getExpandableQueryParts
@NonNull java.lang.String[] getExpandableQueryParts()
The query to execute.- Returns:
- The query to execute
-
getQueryBindings
java.util.List<QueryParameterBinding> getQueryBindings()
The list of query bindings.- Returns:
- the query bindings
-
getResultType
@NonNull java.lang.Class<R> getResultType()
The query result type. This may differ from the root entity type returned bygetRootEntity()
.- Returns:
- The query result type
-
getResultArgument
@NonNull io.micronaut.core.type.Argument<R> getResultArgument()
The query result type. This may differ from the root entity type returned bygetRootEntity()
.- Specified by:
getResultArgument
in interfaceStoredDataOperation<E>
- Returns:
- The query result type
-
getResultDataType
@NonNull DataType getResultDataType()
- Returns:
- The result data type.
-
isNative
default boolean isNative()
In cases where one needs to differentiate between at higher level query format (like JPA-QL) and a lower level format (like SQL).- Returns:
- Whether the query is native.
-
useNumericPlaceholders
boolean useNumericPlaceholders()
Are the placeholders for query set using numeric indices starting from 1.- Returns:
- True if they are.
-
isDtoProjection
default boolean isDtoProjection()
Returns whether the query returns the actual entity or a Data Transfer Object (DTO) project. Defaults to false.- Returns:
- Whether the query is a DTO projection query
-
getEntityIdentifierType
default java.util.Optional<java.lang.Class<?>> getEntityIdentifierType()
The type of the ID member of the entity.- Returns:
- The ID type
-
getArgumentTypes
@NonNull default java.lang.Class<?>[] getArgumentTypes()
The argument types to the method that invokes the query.- Returns:
- The argument types
-
getParameterBinding
@NonNull @Deprecated default java.util.Map<java.lang.String,java.lang.String> getParameterBinding()
Deprecated.The parameter binding. That is the mapping between named query parameters and parameters of the method.- Returns:
- The parameter binding.
-
isCount
boolean isCount()
- Returns:
- Is this a count query.
-
getIndexedParameterTypes
@Deprecated @NonNull default DataType[] getIndexedParameterTypes()
Deprecated.The compute time computed parameter data types for the query indices.- Returns:
- The indexed values
- See Also:
useNumericPlaceholders()
-
getIndexedParameterBinding
@NonNull @Deprecated default int[] getIndexedParameterBinding()
Deprecated.The parameter binding. That is the mapping between named query parameters and parameters of the method.- Returns:
- The parameter binding.
- See Also:
useNumericPlaceholders()
-
getParameterNames
@Deprecated default java.lang.String[] getParameterNames()
Deprecated.- Returns:
- The parameter names the case where named parameters are supported
-
getIndexedParameterPaths
@Deprecated default java.lang.String[] getIndexedParameterPaths()
Deprecated.- Returns:
- The indexed parameter paths.
-
getQueryHints
@NonNull default java.util.Map<java.lang.String,java.lang.Object> getQueryHints()
The parameter binding. That is the mapping between named query parameters and parameters of the method.- Returns:
- The parameter binding.
-
getLastUpdatedProperty
@Deprecated @Nullable default java.lang.String getLastUpdatedProperty()
Deprecated.The name of the last updated property on the entity if any.- Returns:
- The last updated property
-
getIndexedParameterAutoPopulatedPropertyPaths
@Deprecated default java.lang.String[] getIndexedParameterAutoPopulatedPropertyPaths()
Deprecated.The mapping between query parameters and auto populated properties that the parameter represents.- Returns:
- The auto populated properties.
-
getIndexedParameterAutoPopulatedPreviousPropertyPaths
@Deprecated default java.lang.String[] getIndexedParameterAutoPopulatedPreviousPropertyPaths()
Deprecated.The mapping between query parameters and auto populated previous properties that the parameter represents.- Returns:
- The auto populated properties.
-
getIndexedParameterAutoPopulatedPreviousPropertyIndexes
@Deprecated default int[] getIndexedParameterAutoPopulatedPreviousPropertyIndexes()
Deprecated.The mapping between query parameters and auto populated previous properties that the parameter represents.- Returns:
- The auto populated properties.
-
getJoinFetchPaths
@NonNull default java.util.Set<JoinPath> getJoinFetchPaths()
- Returns:
- The join paths that require a fetch
-
isSingleResult
boolean isSingleResult()
Whether the query can be treated as a single result.- Returns:
- True if it can.
-
hasResultConsumer
boolean hasResultConsumer()
- Returns:
- Whether a result consumer is present
-
isOptimisticLock
default boolean isOptimisticLock()
Is with an optimistic lock.- Returns:
- the result
-
isRawQuery
boolean isRawQuery()
Gets an indicator telling whether underlying query is raw query.- Returns:
- true if it is raw query
-
-