Interface FluentQuery.FetchableFluentQuery<T>
- All Superinterfaces:
FluentQuery<T>
- Enclosing interface:
- FluentQuery<T>
Fetchable extension
FluentQuery
allowing to materialize results from the underlying query.- Since:
- 2.6
- Author:
- Mark Paluch
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.data.repository.query.FluentQuery
FluentQuery.FetchableFluentQuery<T>, FluentQuery.ReactiveFluentQuery<T>
-
Method Summary
Modifier and TypeMethodDescriptionall()
Get all matching elements.Define the target type the result should be mapped to.long
count()
Get the number of matching elements.boolean
exists()
Check for the presence of matching elements.first()
Get the first or no result.Get the first or no result.one()
Get exactly zero or one result.oneValue()
Get exactly zero or one result.Get a page of matching elements forPageable
.default FluentQuery.FetchableFluentQuery<T>
Define which properties or property paths to include in the query.project
(Collection<String> properties) Define which properties or property paths to include in the query.Define the sort order.stream()
Stream all matching elements.
-
Method Details
-
sortBy
Description copied from interface:FluentQuery
Define the sort order.- Specified by:
sortBy
in interfaceFluentQuery<T>
- Parameters:
sort
- theSort
specification to sort the results by, may beSort.unsorted()
, must not be null.- Returns:
- a new instance of
FluentQuery
.
-
as
Description copied from interface:FluentQuery
Define the target type the result should be mapped to. Skip this step if you are only interested in the original domain type.- Specified by:
as
in interfaceFluentQuery<T>
- Type Parameters:
R
- result type.- Parameters:
resultType
- must not benull
.- Returns:
- a new instance of
FluentQuery
.
-
project
Description copied from interface:FluentQuery
Define which properties or property paths to include in the query.- Specified by:
project
in interfaceFluentQuery<T>
- Parameters:
properties
- must not benull
.- Returns:
- a new instance of
FluentQuery
.
-
project
Description copied from interface:FluentQuery
Define which properties or property paths to include in the query.- Specified by:
project
in interfaceFluentQuery<T>
- Parameters:
properties
- must not benull
.- Returns:
- a new instance of
FluentQuery
.
-
one
Get exactly zero or one result.- Returns:
Optional.empty()
if no match found.- Throws:
IncorrectResultSizeDataAccessException
- if more than one match found.
-
oneValue
Get exactly zero or one result.- Returns:
- null if no match found.
- Throws:
IncorrectResultSizeDataAccessException
- if more than one match found.
-
first
Get the first or no result.- Returns:
Optional.empty()
if no match found.
-
firstValue
Get the first or no result.- Returns:
- null if no match found.
-
all
Get all matching elements.- Returns:
-
page
Get a page of matching elements forPageable
.- Parameters:
pageable
- the pageable to request a paged result, can bePageable.unpaged()
, must not be null. The givenPageable
will override any previously specifiedsort
if theSort
object is notSort.isUnsorted()
.- Returns:
-
stream
Stream all matching elements.- Returns:
- a
Stream
wrapping cursors that need to be closed.
-
count
long count()Get the number of matching elements.- Returns:
- total number of matching elements.
-
exists
boolean exists()Check for the presence of matching elements.- Returns:
- true if at least one matching element exists.
-