Interface QueryHints

All Known Implementing Classes:
MutableQueryHints, QueryHints.NoHints

public interface QueryHints
QueryHints provides access to query hints defined via CrudMethodMetadata.getQueryHints() QueryHintList()} by default excluding JPA EntityGraph. The object allows to switch between query hints for count queries with or without fetch graph hints.
Since:
2.0
Author:
Christoph Strobl, Oliver Gierke, Jens Schauder
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    Null object implementation of QueryHints.
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates and returns a new QueryHints instance that will contain only those hints applicable for count queries.
    void
    Performs the given action for each element of this query hints object until all hints have been processed or the action throws an exception.
    static QueryHints
    from(QueryHints... sources)
    Create a new QueryHints object from the given sources.
    withFetchGraphs(jakarta.persistence.EntityManager em)
    Creates and returns a new QueryHints instance including EntityGraph.
  • Method Details

    • from

      static QueryHints from(QueryHints... sources)
      Create a new QueryHints object from the given sources.
      Parameters:
      sources - must not be null.
      Returns:
      a merged representation of QueryHints.
      Since:
      2.4
    • withFetchGraphs

      QueryHints withFetchGraphs(jakarta.persistence.EntityManager em)
      Creates and returns a new QueryHints instance including EntityGraph.
      Parameters:
      em - must not be null.
      Returns:
      new instance of QueryHints.
    • forCounts

      QueryHints forCounts()
      Creates and returns a new QueryHints instance that will contain only those hints applicable for count queries.
      Returns:
      new instance of QueryHints.
      Since:
      2.2
    • forEach

      void forEach(BiConsumer<String,Object> action)
      Performs the given action for each element of this query hints object until all hints have been processed or the action throws an exception. Actions are performed in the order of iteration, if that order is specified. Exceptions thrown by the action are relayed to the caller.

      Passes each query hint to the consumer. Query hint keys might appear more than once.

      Parameters:
      action - to process query hints consisting of a key and a value.
      Since:
      2.4