Class DefaultStoredQuery<E,RT>
java.lang.Object
io.micronaut.data.model.runtime.DefaultStoredDataOperation<RT>
io.micronaut.data.runtime.query.internal.DefaultStoredQuery<E,RT>
- Type Parameters:
E
- The entity typeRT
- The result type
- All Implemented Interfaces:
io.micronaut.core.annotation.AnnotationMetadataProvider
,io.micronaut.core.annotation.AnnotationSource
,io.micronaut.core.naming.Named
,StoredDataOperation<RT>
,StoredQuery<E,
RT>
@Internal
public final class DefaultStoredQuery<E,RT>
extends DefaultStoredDataOperation<RT>
implements StoredQuery<E,RT>
Represents a prepared query.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.micronaut.data.model.runtime.StoredQuery
StoredQuery.OperationType
-
Field Summary
Fields inherited from interface io.micronaut.core.annotation.AnnotationSource
EMPTY
-
Constructor Summary
ConstructorDescriptionDefaultStoredQuery
(@NonNull io.micronaut.inject.ExecutableMethod<?, ?> method, @NonNull Class<RT> resultType, @NonNull Class<E> rootEntity, @NonNull String query, boolean isCount, HintsCapableRepository repositoryOperations) The default constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
@NonNull Class<?>[]
The argument types to the method that invokes the query.The type of the ID member of the entity.String[]
The query to execute.io.micronaut.inject.ExecutableMethod<?,
?> @NonNull String
getName()
Get the operation type.Parameter expressions.@NonNull String
getQuery()
The query to execute.The list of query bindings.The parameter binding.@NonNull DataType
The query result type.The root entity type.int
hashCode()
boolean
Does the query have a pageable.boolean
boolean
isCount()
boolean
Returns whether the query returns the actual entity or a Data Transfer Object (DTO) project.boolean
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).boolean
Is with an optimistic lock.boolean
Is the query a procedure.boolean
Gets an indicator telling whether underlying query is raw query.boolean
Whether the query can be treated as a single result.boolean
Is this a raw SQL query.Methods inherited from class io.micronaut.data.model.runtime.DefaultStoredDataOperation
getAnnotationMetadata, getResultArgument
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataProvider
findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, getAnnotationMetadata, getTargetAnnotationMetadata, 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.StoredQuery
getResultArgument
-
Constructor Details
-
DefaultStoredQuery
public DefaultStoredQuery(@NonNull @NonNull io.micronaut.inject.ExecutableMethod<?, ?> method, @NonNull @NonNull Class<RT> resultType, @NonNull @NonNull Class<E> rootEntity, @NonNull @NonNull String query, boolean isCount, HintsCapableRepository repositoryOperations) The default constructor.- Parameters:
method
- The target methodresultType
- The result type of the queryrootEntity
- The root entity of the queryquery
- The query itselfisCount
- Is the query a count queryrepositoryOperations
- The repositoryOperations
-
-
Method Details
-
getQueryBindings
Description copied from interface:StoredQuery
The list of query bindings.- Specified by:
getQueryBindings
in interfaceStoredQuery<E,
RT> - Returns:
- the query bindings
-
getJoinFetchPaths
- Specified by:
getJoinFetchPaths
in interfaceStoredQuery<E,
RT> - Returns:
- The join paths that require a fetch
-
getMethod
public io.micronaut.inject.ExecutableMethod<?,?> getMethod()- Returns:
- The method
-
isSingleResult
public boolean isSingleResult()Description copied from interface:StoredQuery
Whether the query can be treated as a single result.- Specified by:
isSingleResult
in interfaceStoredQuery<E,
RT> - Returns:
- True if it can.
-
hasResultConsumer
public boolean hasResultConsumer()- Specified by:
hasResultConsumer
in interfaceStoredQuery<E,
RT> - Returns:
- Whether a result consumer is present
-
isCount
public boolean isCount()- Specified by:
isCount
in interfaceStoredQuery<E,
RT> - Returns:
- Is this a count query.
-
getQueryHints
Description copied from interface:StoredQuery
The parameter binding. That is the mapping between named query parameters and parameters of the method.- Specified by:
getQueryHints
in interfaceStoredQuery<E,
RT> - Returns:
- The parameter binding.
-
isNative
public boolean isNative()Description copied from interface:StoredQuery
In cases where one needs to differentiate between at higher level query format (like JPA-QL) and a lower level format (like SQL).- Specified by:
isNative
in interfaceStoredQuery<E,
RT> - Returns:
- Whether the query is native.
-
isProcedure
public boolean isProcedure()Description copied from interface:StoredQuery
Is the query a procedure.- Specified by:
isProcedure
in interfaceStoredQuery<E,
RT> - Returns:
- Whether the query is a procedure invocation.
-
getOperationType
Description copied from interface:StoredQuery
Get the operation type.- Specified by:
getOperationType
in interfaceStoredQuery<E,
RT> - Returns:
- The operation type.
-
useNumericPlaceholders
public boolean useNumericPlaceholders()Is this a raw SQL query.- Specified by:
useNumericPlaceholders
in interfaceStoredQuery<E,
RT> - Returns:
- The raw sql query.
-
isDtoProjection
public boolean isDtoProjection()Description copied from interface:StoredQuery
Returns whether the query returns the actual entity or a Data Transfer Object (DTO) project. Defaults to false.- Specified by:
isDtoProjection
in interfaceStoredQuery<E,
RT> - Returns:
- Whether the query is a DTO query
-
getResultType
Description copied from interface:StoredQuery
The query result type. This may differ from the root entity type returned byStoredQuery.getRootEntity()
.- Specified by:
getResultType
in interfaceStoredQuery<E,
RT> - Returns:
- The result type
-
getResultDataType
- Specified by:
getResultDataType
in interfaceStoredQuery<E,
RT> - Returns:
- The result data type.
-
getEntityIdentifierType
Description copied from interface:StoredQuery
The type of the ID member of the entity.- Specified by:
getEntityIdentifierType
in interfaceStoredQuery<E,
RT> - Returns:
- The ID type
-
getRootEntity
Description copied from interface:StoredQuery
The root entity type.- Specified by:
getRootEntity
in interfaceStoredQuery<E,
RT> - Returns:
- The root entity type
-
hasPageable
public boolean hasPageable()Description copied from interface:StoredQuery
Does the query have a pageable.- Specified by:
hasPageable
in interfaceStoredQuery<E,
RT> - Returns:
- True if it does
-
getQuery
Description copied from interface:StoredQuery
The query to execute.- Specified by:
getQuery
in interfaceStoredQuery<E,
RT> - Returns:
- The query to execute
-
getExpandableQueryParts
Description copied from interface:StoredQuery
The query to execute.- Specified by:
getExpandableQueryParts
in interfaceStoredQuery<E,
RT> - Returns:
- The query to execute
-
getName
- Specified by:
getName
in interfaceio.micronaut.core.naming.Named
-
getArgumentTypes
Description copied from interface:StoredQuery
The argument types to the method that invokes the query.- Specified by:
getArgumentTypes
in interfaceStoredQuery<E,
RT> - Returns:
- The argument types
-
isOptimisticLock
public boolean isOptimisticLock()Description copied from interface:StoredQuery
Is with an optimistic lock.- Specified by:
isOptimisticLock
in interfaceStoredQuery<E,
RT> - Returns:
- the result
-
isRawQuery
public boolean isRawQuery()Description copied from interface:StoredQuery
Gets an indicator telling whether underlying query is raw query.- Specified by:
isRawQuery
in interfaceStoredQuery<E,
RT> - Returns:
- true if it is raw query
-
isJsonEntity
public boolean isJsonEntity()- Specified by:
isJsonEntity
in interfaceStoredQuery<E,
RT> - Returns:
- an indicator telling whether query is handling entities with JSON representation (like Oracle Json View)
-
getParameterExpressions
Description copied from interface:StoredQuery
Parameter expressions.- Specified by:
getParameterExpressions
in interfaceStoredQuery<E,
RT> - Returns:
- Parameter expressions.
-
equals
-
hashCode
public int hashCode()
-