Interface QueryExecutionStrategy<T>
- All Known Implementing Classes:
JpaSpecificationExecutionStrategy,QuerydslExecutionStrategy
public interface QueryExecutionStrategy<T>
Strategy abstraction for executing queries using either QueryDSL or JPA Specifications.
-
Method Summary
Modifier and TypeMethodDescriptionlongcount(com.querydsl.core.types.Predicate predicate, org.springframework.data.jpa.domain.Specification<T> spec) Counts the number of entities matching the given predicate and specification.booleanexists(com.querydsl.core.types.Predicate predicate, org.springframework.data.jpa.domain.Specification<T> spec) Checks if any entity matches the given predicate and specification.findAll(com.querydsl.core.types.Predicate predicate, org.springframework.data.jpa.domain.Specification<T> spec) Finds all entities matching the given predicate and specification.<R> List<R> findAll(com.querydsl.core.types.Predicate predicate, org.springframework.data.jpa.domain.Specification<T> spec, Class<R> projection) Finds all entities matching the given predicate and specification, returning a paginated result.org.springframework.data.domain.Page<T> findAll(com.querydsl.core.types.Predicate predicate, org.springframework.data.jpa.domain.Specification<T> spec, org.springframework.data.domain.Pageable pageable) Finds all entities matching the given predicate and specification, returning a paginated result.<R> org.springframework.data.domain.Page<R> findAll(com.querydsl.core.types.Predicate predicate, org.springframework.data.jpa.domain.Specification<T> spec, org.springframework.data.domain.Pageable pageable, Class<R> projection) Finds all entities matching the given predicate and specification, returning a paginated result.findOne(com.querydsl.core.types.Predicate predicate, org.springframework.data.jpa.domain.Specification<T> spec) Finds a single entity matching the given predicate and specification.<R> Optional<R> findOne(com.querydsl.core.types.Predicate predicate, org.springframework.data.jpa.domain.Specification<T> spec, Class<R> projection) Finds a single entity matching the given predicate and specification.
-
Method Details
-
findAll
org.springframework.data.domain.Page<T> findAll(com.querydsl.core.types.Predicate predicate, org.springframework.data.jpa.domain.Specification<T> spec, org.springframework.data.domain.Pageable pageable) Finds all entities matching the given predicate and specification, returning a paginated result.- Parameters:
predicate- the QueryDSL predicate to filter resultsspec- the JPA specification to apply additional filterspageable- the pagination information- Returns:
- a page of entities matching the criteria
-
findAll
List<T> findAll(com.querydsl.core.types.Predicate predicate, org.springframework.data.jpa.domain.Specification<T> spec) Finds all entities matching the given predicate and specification.- Parameters:
predicate- the QueryDSL predicate to filter resultsspec- the JPA specification to apply additional filters- Returns:
- a list of entities matching the criteria
-
findAll
<R> org.springframework.data.domain.Page<R> findAll(com.querydsl.core.types.Predicate predicate, org.springframework.data.jpa.domain.Specification<T> spec, org.springframework.data.domain.Pageable pageable, Class<R> projection) Finds all entities matching the given predicate and specification, returning a paginated result.- Parameters:
predicate- the Querydsl predicate to filter resultsspec- the JPA specification to apply additional filterspageable- the pagination informationprojection- the class type for the projection- Returns:
- a page of entities matching given criteria, projected to the specified type.
-
findAll
<R> List<R> findAll(com.querydsl.core.types.Predicate predicate, org.springframework.data.jpa.domain.Specification<T> spec, Class<R> projection) Finds all entities matching the given predicate and specification, returning a paginated result.- Parameters:
predicate- the QueryDSL predicate to filter resultsspec- the JPA specification to apply additional filtersprojection- the class type for the projection- Returns:
- a page of entities matching the criteria, projected to the specified type
-
findOne
Optional<T> findOne(com.querydsl.core.types.Predicate predicate, org.springframework.data.jpa.domain.Specification<T> spec) Finds a single entity matching the given predicate and specification.- Parameters:
predicate- the QueryDSL predicate to filter resultsspec- the JPA specification to apply additional filters- Returns:
- an Optional containing the found entity, or empty if none found
-
findOne
<R> Optional<R> findOne(com.querydsl.core.types.Predicate predicate, org.springframework.data.jpa.domain.Specification<T> spec, Class<R> projection) Finds a single entity matching the given predicate and specification.- Parameters:
predicate- the QueryDSL predicate to filter resultsspec- the JPA specification to apply additional filters- Returns:
- an Optional containing the found entity, or empty if none found
-
exists
boolean exists(com.querydsl.core.types.Predicate predicate, org.springframework.data.jpa.domain.Specification<T> spec) Checks if any entity matches the given predicate and specification.- Parameters:
predicate- the QueryDSL predicate to filter resultsspec- the JPA specification to apply additional filters- Returns:
- true if at least one entity matches the criteria, false otherwise
-
count
long count(com.querydsl.core.types.Predicate predicate, org.springframework.data.jpa.domain.Specification<T> spec) Counts the number of entities matching the given predicate and specification.- Parameters:
predicate- the QueryDSL predicate to filter resultsspec- the JPA specification to apply additional filters- Returns:
- the count of entities matching the criteria
-