Class 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 Detail

      • DefaultStoredQuery

        public DefaultStoredQuery​(@NonNull
                                  io.micronaut.inject.ExecutableMethod<?,​?> method,
                                  @NonNull
                                  java.lang.Class<RT> resultType,
                                  @NonNull
                                  java.lang.Class<E> rootEntity,
                                  @NonNull
                                  java.lang.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 Detail

      • 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 java.util.Map<java.lang.String,​java.lang.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
      • getEntityIdentifierType

        public java.util.Optional<java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.String getName()
        Specified by:
        getName in interface io.micronaut.core.naming.Named
      • getArgumentTypes

        @NonNull
        public java.lang.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
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object