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 type
RT - 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.
  • 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 method
      resultType - The result type of the query
      rootEntity - The root entity of the query
      query - The query itself
      isCount - Is the query a count query
      repositoryOperations - The repositoryOperations
  • Method Details

    • getQueryBindings

      public List<QueryParameterBinding> getQueryBindings()
      Description copied from interface: StoredQuery
      The list of query bindings.
      Specified by:
      getQueryBindings in interface StoredQuery<E,RT>
      Returns:
      the query bindings
    • getJoinFetchPaths

      @NonNull public @NonNull Set<JoinPath> getJoinFetchPaths()
      Specified by:
      getJoinFetchPaths in interface StoredQuery<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 interface StoredQuery<E,RT>
      Returns:
      True if it can.
    • hasResultConsumer

      public boolean hasResultConsumer()
      Specified by:
      hasResultConsumer in interface StoredQuery<E,RT>
      Returns:
      Whether a result consumer is present
    • isCount

      public boolean isCount()
      Specified by:
      isCount in interface StoredQuery<E,RT>
      Returns:
      Is this a count query.
    • getQueryHints

      @NonNull public @NonNull Map<String,Object> 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 interface StoredQuery<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 interface StoredQuery<E,RT>
      Returns:
      Whether the query is native.
    • useNumericPlaceholders

      public boolean useNumericPlaceholders()
      Is this a raw SQL query.
      Specified by:
      useNumericPlaceholders in interface StoredQuery<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 interface StoredQuery<E,RT>
      Returns:
      Whether the query is a DTO query
    • getResultType

      @NonNull public @NonNull Class<RT> getResultType()
      Description copied from interface: StoredQuery
      The query result type. This may differ from the root entity type returned by StoredQuery.getRootEntity().
      Specified by:
      getResultType in interface StoredQuery<E,RT>
      Returns:
      The result type
    • getResultDataType

      @NonNull public @NonNull DataType getResultDataType()
      Specified by:
      getResultDataType in interface StoredQuery<E,RT>
      Returns:
      The result data type.
    • getEntityIdentifierType

      public Optional<Class<?>> getEntityIdentifierType()
      Description copied from interface: StoredQuery
      The type of the ID member of the entity.
      Specified by:
      getEntityIdentifierType in interface StoredQuery<E,RT>
      Returns:
      The ID type
    • getRootEntity

      @NonNull public @NonNull Class<E> getRootEntity()
      Description copied from interface: StoredQuery
      The root entity type.
      Specified by:
      getRootEntity in interface StoredQuery<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 interface StoredQuery<E,RT>
      Returns:
      True if it does
    • getQuery

      @NonNull public @NonNull String getQuery()
      Description copied from interface: StoredQuery
      The query to execute.
      Specified by:
      getQuery in interface StoredQuery<E,RT>
      Returns:
      The query to execute
    • getExpandableQueryParts

      public String[] getExpandableQueryParts()
      Description copied from interface: StoredQuery
      The query to execute.
      Specified by:
      getExpandableQueryParts in interface StoredQuery<E,RT>
      Returns:
      The query to execute
    • getName

      @NonNull public @NonNull String getName()
      Specified by:
      getName in interface io.micronaut.core.naming.Named
    • getArgumentTypes

      @NonNull public @NonNull Class<?>[] getArgumentTypes()
      Description copied from interface: StoredQuery
      The argument types to the method that invokes the query.
      Specified by:
      getArgumentTypes in interface StoredQuery<E,RT>
      Returns:
      The argument types
    • isOptimisticLock

      public boolean isOptimisticLock()
      Description copied from interface: StoredQuery
      Is with an optimistic lock.
      Specified by:
      isOptimisticLock in interface StoredQuery<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 interface StoredQuery<E,RT>
      Returns:
      true if it is raw query
    • isJsonEntity

      public boolean isJsonEntity()
      Specified by:
      isJsonEntity in interface StoredQuery<E,RT>
      Returns:
      an indicator telling whether query is handling entities with JSON representation (like Oracle Json View)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object