Class QuerydslJpaPredicateExecutor<T>
java.lang.Object
org.springframework.data.jpa.repository.support.QuerydslJpaPredicateExecutor<T>
- All Implemented Interfaces:
JpaRepositoryConfigurationAware, QuerydslPredicateExecutor<T>
public class QuerydslJpaPredicateExecutor<T>
extends Object
implements QuerydslPredicateExecutor<T>, JpaRepositoryConfigurationAware
Querydsl specific fragment for extending
SimpleJpaRepository with an implementation of
QuerydslPredicateExecutor.- Author:
- Oliver Gierke, Thomas Darimont, Mark Paluch, Jocelyn Ntakpe, Christoph Strobl, Jens Schauder, Greg Turnquist, Yanming Zhou
-
Constructor Summary
ConstructorsConstructorDescriptionQuerydslJpaPredicateExecutor(JpaEntityInformation<T, ?> entityInformation, jakarta.persistence.EntityManager entityManager, EntityPathResolver resolver, @Nullable CrudMethodMetadata metadata) Creates a newQuerydslJpaPredicateExecutorfrom the given domain class andEntityManagerand uses the givenEntityPathResolverto translate the domain class into anEntityPath. -
Method Summary
Modifier and TypeMethodDescriptionlongcount(com.querydsl.core.types.Predicate predicate) protected com.querydsl.jpa.JPQLQuery<?> createCountQuery(@Nullable com.querydsl.core.types.Predicate... predicate) Creates a newJPQLQuerycount query for the givenPredicate.protected com.querydsl.jpa.impl.AbstractJPAQuery<?, ?> createQuery(com.querydsl.core.types.Predicate... predicate) Creates a newJPQLQueryfor the givenPredicate.longdelete(com.querydsl.core.types.Predicate predicate) Delete entities by the givenPredicateby loading and removing these.booleanexists(com.querydsl.core.types.Predicate predicate) findAll(com.querydsl.core.types.OrderSpecifier<?>... orders) findAll(com.querydsl.core.types.Predicate predicate) findAll(com.querydsl.core.types.Predicate predicate, com.querydsl.core.types.OrderSpecifier<?>... orders) findBy(com.querydsl.core.types.Predicate predicate, Function<FluentQuery.FetchableFluentQuery<S>, R> queryFunction) findOne(com.querydsl.core.types.Predicate predicate) voidsetProjectionFactory(ProjectionFactory projectionFactory) Configures theProjectionFactoryto be used with the repository.voidConfigures theCrudMethodMetadatato be used with the repository.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface JpaRepositoryConfigurationAware
setEscapeCharacter
-
Constructor Details
-
QuerydslJpaPredicateExecutor
public QuerydslJpaPredicateExecutor(JpaEntityInformation<T, ?> entityInformation, jakarta.persistence.EntityManager entityManager, EntityPathResolver resolver, @Nullable CrudMethodMetadata metadata) Creates a newQuerydslJpaPredicateExecutorfrom the given domain class andEntityManagerand uses the givenEntityPathResolverto translate the domain class into anEntityPath.- Parameters:
entityInformation- must not be null.entityManager- must not be null.resolver- must not be null.metadata- maybe null.
-
-
Method Details
-
setRepositoryMethodMetadata
Description copied from interface:JpaRepositoryConfigurationAwareConfigures theCrudMethodMetadatato be used with the repository.- Specified by:
setRepositoryMethodMetadatain interfaceJpaRepositoryConfigurationAware- Parameters:
metadata- must not be null.
-
setProjectionFactory
Description copied from interface:JpaRepositoryConfigurationAwareConfigures theProjectionFactoryto be used with the repository.- Specified by:
setProjectionFactoryin interfaceJpaRepositoryConfigurationAware- Parameters:
projectionFactory- must not be null.
-
findOne
- Specified by:
findOnein interfaceQuerydslPredicateExecutor<T>
-
findAll
- Specified by:
findAllin interfaceQuerydslPredicateExecutor<T>
-
findAll
public List<T> findAll(com.querydsl.core.types.Predicate predicate, com.querydsl.core.types.OrderSpecifier<?>... orders) - Specified by:
findAllin interfaceQuerydslPredicateExecutor<T>
-
findAll
-
findAll
- Specified by:
findAllin interfaceQuerydslPredicateExecutor<T>
-
findAll
-
findBy
public <S extends T, R extends @Nullable Object> R findBy(com.querydsl.core.types.Predicate predicate, Function<FluentQuery.FetchableFluentQuery<S>, R> queryFunction) - Specified by:
findByin interfaceQuerydslPredicateExecutor<T>
-
count
public long count(com.querydsl.core.types.Predicate predicate) - Specified by:
countin interfaceQuerydslPredicateExecutor<T>
-
delete
public long delete(com.querydsl.core.types.Predicate predicate) Delete entities by the givenPredicateby loading and removing these.This method is useful for a small amount of entities. For large amounts of entities, consider using batch deletes by declaring a delete query yourself.
- Parameters:
predicate- thePredicateto delete entities by, must not be null.- Returns:
- number of deleted entities.
- Since:
- 4.0
-
exists
public boolean exists(com.querydsl.core.types.Predicate predicate) - Specified by:
existsin interfaceQuerydslPredicateExecutor<T>
-
createQuery
protected com.querydsl.jpa.impl.AbstractJPAQuery<?,?> createQuery(com.querydsl.core.types.Predicate... predicate) Creates a newJPQLQueryfor the givenPredicate.- Parameters:
predicate-- Returns:
- the Querydsl
JPQLQuery.
-
createCountQuery
protected com.querydsl.jpa.JPQLQuery<?> createCountQuery(@Nullable com.querydsl.core.types.Predicate... predicate) Creates a newJPQLQuerycount query for the givenPredicate.- Parameters:
predicate- , can be null.- Returns:
- the Querydsl count
JPQLQuery.
-