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 -
Method Summary
Modifier and TypeMethodDescriptionCreates and returns a newQueryHintsinstance that will contain only those hints applicable for count queries.voidforEach(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.static QueryHintsfrom(QueryHints... sources) Create a newQueryHintsobject from the givensources.withFetchGraphs(jakarta.persistence.EntityManager em) Creates and returns a newQueryHintsinstance includingEntityGraph.
-
Method Details
-
from
Create a newQueryHintsobject from the givensources.- Parameters:
sources- must not be null.- Returns:
- a merged representation of
QueryHints. - Since:
- 2.4
-
withFetchGraphs
Creates and returns a newQueryHintsinstance includingEntityGraph.- Parameters:
em- must not be null.- Returns:
- new instance of
QueryHints.
-
forCounts
QueryHints forCounts()Creates and returns a newQueryHintsinstance that will contain only those hints applicable for count queries.- Returns:
- new instance of
QueryHints. - Since:
- 2.2
-
forEach
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
-