Interface QueryByExampleExecutor<T>
- Type Parameters:
T-
- All Known Subinterfaces:
ListQueryByExampleExecutor<T>
public interface QueryByExampleExecutor<T>
Interface to allow execution of Query by Example
Example instances.- Since:
- 1.12
- Author:
- Mark Paluch, Christoph Strobl, Diego Krupitza
- See Also:
-
Method Summary
Modifier and TypeMethodDescription<S extends T>
longReturns the number of instances matching the givenExample.<S extends T>
booleanChecks whether the data store contains elements that match the givenExample.Returns all entities matching the givenExample.<S extends T,R>
RfindBy(Example<S> example, Function<FluentQuery.FetchableFluentQuery<S>, R> queryFunction) Returns entities matching the givenExampleapplying thequeryFunctionthat defines the query and its result type.Returns a single entity matching the givenExampleorOptional.empty()if none was found.
-
Method Details
-
findOne
Returns a single entity matching the givenExampleorOptional.empty()if none was found.- Parameters:
example- must not be null.- Returns:
- a single entity matching the given
ExampleorOptional.empty()if none was found. - Throws:
org.springframework.dao.IncorrectResultSizeDataAccessException- if the Example yields more than one result.
-
findAll
Returns all entities matching the givenExample. In case no match could be found an emptyIterableis returned.- Parameters:
example- must not be null.- Returns:
- all entities matching the given
Example.
-
findAll
Returns all entities matching the givenExampleapplying the givenSort. In case no match could be found an emptyIterableis returned.- Parameters:
example- must not be null.sort- theSortspecification to sort the results by, may beSort.unsorted(), must not be null.- Returns:
- all entities matching the given
Example. - Since:
- 1.10
-
findAll
Returns aPageof entities matching the givenExample. In case no match could be found, an emptyPageis returned.- Parameters:
example- must not be null.pageable- the pageable to request a paged result, can bePageable.unpaged(), must not be null.- Returns:
- a
Pageof entities matching the givenExample.
-
count
Returns the number of instances matching the givenExample. -
exists
Checks whether the data store contains elements that match the givenExample. -
findBy
<S extends T,R> R findBy(Example<S> example, Function<FluentQuery.FetchableFluentQuery<S>, R> queryFunction) Returns entities matching the givenExampleapplying thequeryFunctionthat defines the query and its result type.- Parameters:
example- must not be null.queryFunction- the query function defining projection, sorting, and the result type- Returns:
- all entities matching the given
Example. - Since:
- 2.6
-