Package io.micronaut.data.jpa.repository
Interface JpaSpecificationExecutor<T>
-
- Type Parameters:
T
- The entity type
public interface JpaSpecificationExecutor<T>
Interface to allow execution ofSpecification
s based on the JPA criteria API. Note: Forked from 'org.springframework.data.jpa.repository.JpaSpecificationExecutor'.- Since:
- 3.1
- Author:
- Oliver Gierke, Christoph Strobl
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
count(Specification<T> spec)
Returns the number of instances that the givenSpecification
will return.java.util.List<T>
findAll(Specification<T> spec)
Returns all entities matching the givenSpecification
.Page<T>
findAll(Specification<T> spec, Pageable pageable)
Returns aPage
of entities matching the givenSpecification
.java.util.List<T>
findAll(Specification<T> spec, Sort sort)
Returns all entities matching the givenSpecification
andSort
.java.util.Optional<T>
findOne(Specification<T> spec)
Returns a single entity matching the givenSpecification
orOptional.empty()
if none found.
-
-
-
Method Detail
-
findOne
java.util.Optional<T> findOne(@Nullable Specification<T> spec)
Returns a single entity matching the givenSpecification
orOptional.empty()
if none found.- Parameters:
spec
- can be null.- Returns:
- never null.
-
findAll
java.util.List<T> findAll(@Nullable Specification<T> spec)
Returns all entities matching the givenSpecification
.- Parameters:
spec
- can be null.- Returns:
- never null.
-
findAll
Page<T> findAll(@Nullable Specification<T> spec, Pageable pageable)
Returns aPage
of entities matching the givenSpecification
.- Parameters:
spec
- can be null.pageable
- must not be null.- Returns:
- never null.
-
findAll
java.util.List<T> findAll(@Nullable Specification<T> spec, Sort sort)
Returns all entities matching the givenSpecification
andSort
.- Parameters:
spec
- can be null.sort
- must not be null.- Returns:
- never null.
-
count
long count(@Nullable Specification<T> spec)
Returns the number of instances that the givenSpecification
will return.- Parameters:
spec
- theSpecification
to count instances for. Can be null.- Returns:
- the number of instances.
-
-