Spring Data Commons - Reference Documentation 05.07.
2021, 21:54
(and the other keywords) and by .
…Distinct… Use a distinct query to return only unique results. Consult the
store-speci!c documentation whether that feature is supported.
This keyword can occur in any place of the subject between
find (and the other keywords) and by .
Supported query method predicate keywords and modifiers
The following table lists the predicate keywords generally supported by the Spring Data
repository query derivation mechanism. However, consult the store-speci!c
documentation for the exact list of supported keywords, because some keywords listed
here might not be supported in a particular store.
Table 6. Query predicate keywords
Logical keyword Keyword expressions
AND And
OR Or
AFTER After , IsAfter
BEFORE Before , IsBefore
CONTAINING Containing , IsContaining , Contains
BETWEEN Between , IsBetween
ENDING_WITH EndingWith , IsEndingWith , EndsWith
EXISTS Exists
FALSE False , IsFalse
GREATER_THAN GreaterThan , IsGreaterThan
https://docs.spring.io/spring-data/commons/docs/2.5.2/reference/html/#auditing Page 80 of 85
Spring Data Commons - Reference Documentation 05.07.2021, 21:54
GREATER_THAN_EQU GreaterThanEqual , IsGreaterThanEqual
ALS
IN In , IsIn
IS Is , Equals , (or no keyword)
IS_EMPTY IsEmpty , Empty
IS_NOT_EMPTY IsNotEmpty , NotEmpty
IS_NOT_NULL NotNull , IsNotNull
IS_NULL Null , IsNull
LESS_THAN LessThan , IsLessThan
LESS_THAN_EQUAL LessThanEqual , IsLessThanEqual
LIKE Like , IsLike
NEAR Near , IsNear
NOT Not , IsNot
NOT_IN NotIn , IsNotIn
NOT_LIKE NotLike , IsNotLike
REGEX Regex , MatchesRegex , Matches
STARTING_WITH StartingWith , IsStartingWith , StartsWith
TRUE True , IsTrue
WITHIN Within , IsWithin
In addition to !lter predicates, the following list of modi!ers is supported:
Table 7. Query predicate modi!er keywords
https://docs.spring.io/spring-data/commons/docs/2.5.2/reference/html/#auditing Page 81 of 85
Spring Data Commons - Reference Documentation 05.07.2021, 21:54
Keyword Description
IgnoreCase , Used with a predicate keyword for case-insensitive comparison.
IgnoringCase
AllIgnoreCase , Ignore case for all suitable properties. Used somewhere in the
AllIgnoringCase query method predicate.
OrderBy… Specify a static sorting order followed by the property path and
direction (e. g. OrderByFirstnameAscLastnameDesc ).
Appendix D: Repository query return types
Supported Query Return Types
The following table lists the return types generally supported by Spring Data repositories.
However, consult the store-speci!c documentation for the exact list of supported return
types, because some types listed here might not be supported in a particular store.
Geospatial types (such as GeoResult , GeoResults , and GeoPage ) are available
only for data stores that support geospatial queries. Some store modules may
de!ne their own result wrapper types.
Table 8. Query return types
Return type Description
void Denotes no return value.
Primitives Java primitives.
Wrapper types Java wrapper types.
https://docs.spring.io/spring-data/commons/docs/2.5.2/reference/html/#auditing Page 82 of 85
Spring Data Commons - Reference Documentation 05.07.2021, 21:54
T A unique entity. Expects the query method to return one result
at most. If no result is found, null is returned. More than one
result triggers an IncorrectResultSizeDataAccessException .
Iterator<T> An Iterator .
Collection<T> A Collection .
List<T> A List .
Optional<T> A Java 8 or Guava Optional . Expects the query method to
return one result at most. If no result is found,
Optional.empty() or Optional.absent() is returned. More
than one result triggers an
IncorrectResultSizeDataAccessException .
Option<T> Either a Scala or Vavr Option type. Semantically the same
behavior as Java 8’s Optional , described earlier.
Stream<T> A Java 8 Stream .
Streamable<T> A convenience extension of Iterable that directy exposes
methods to stream, map and !lter results, concatenate them
etc.
Types that Types that expose a constructor or ….of(…) / ….valueOf(…)
implement factory method taking a Streamable as argument. See
Streamable and Returning Custom Streamable Wrapper Types for details.
take a Streamable
constructor or
factory method
argument
Vavr Seq , List , Vavr collection types. See Support for Vavr Collections for
Map , Set details.
Future<T> A Future . Expects a method to be annotated with @Async and
requires Spring’s asynchronous method execution capability to
be enabled.
https://docs.spring.io/spring-data/commons/docs/2.5.2/reference/html/#auditing Page 83 of 85
Spring Data Commons - Reference Documentation 05.07.2021, 21:54
CompletableFutur A Java 8 CompletableFuture . Expects a method to be
e<T> annotated with @Async and requires Spring’s asynchronous
method execution capability to be enabled.
ListenableFuture A org.springframework.util.concurrent.ListenableFuture .
Expects a method to be annotated with @Async and requires
Spring’s asynchronous method execution capability to be
enabled.
Slice<T> A sized chunk of data with an indication of whether there is
more data available. Requires a Pageable method parameter.
Page<T> A Slice with additional information, such as the total number
of results. Requires a Pageable method parameter.
GeoResult<T> A result entry with additional information, such as the distance
to a reference location.
GeoResults<T> A list of GeoResult<T> with additional information, such as the
average distance to a reference location.
GeoPage<T> A Page with GeoResult<T> , such as the average distance to a
reference location.
Mono<T> A Project Reactor Mono emitting zero or one element using
reactive repositories. Expects the query method to return one
result at most. If no result is found, Mono.empty() is returned.
More than one result triggers an
IncorrectResultSizeDataAccessException .
Flux<T> A Project Reactor Flux emitting zero, one, or many elements
using reactive repositories. Queries returning Flux can emit
also an in!nite number of elements.
Single<T> A RxJava Single emitting a single element using reactive
repositories. Expects the query method to return one result at
most. If no result is found, Mono.empty() is returned. More
than one result triggers an
https://docs.spring.io/spring-data/commons/docs/2.5.2/reference/html/#auditing Page 84 of 85
Spring Data Commons - Reference Documentation 05.07.2021, 21:54
IncorrectResultSizeDataAccessException .
Maybe<T> A RxJava Maybe emitting zero or one element using reactive
repositories. Expects the query method to return one result at
most. If no result is found, Mono.empty() is returned. More
than one result triggers an
IncorrectResultSizeDataAccessException .
Flowable<T> A RxJava Flowable emitting zero, one, or many elements using
reactive repositories. Queries returning Flowable can emit also
an in!nite number of elements.
1. see XML Con!guration
Version 2.5.2
Last updated 2021-06-22 16:11:59 +0200
https://docs.spring.io/spring-data/commons/docs/2.5.2/reference/html/#auditing Page 85 of 85