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 Details

    • QuerydslJpaPredicateExecutor

      public QuerydslJpaPredicateExecutor(JpaEntityInformation<T,?> entityInformation, jakarta.persistence.EntityManager entityManager, EntityPathResolver resolver, @Nullable CrudMethodMetadata metadata)
      Creates a new QuerydslJpaPredicateExecutor from the given domain class and EntityManager and uses the given EntityPathResolver to translate the domain class into an EntityPath.
      Parameters:
      entityInformation - must not be null.
      entityManager - must not be null.
      resolver - must not be null.
      metadata - maybe null.
  • Method Details

    • setRepositoryMethodMetadata

      public void setRepositoryMethodMetadata(CrudMethodMetadata metadata)
      Description copied from interface: JpaRepositoryConfigurationAware
      Configures the CrudMethodMetadata to be used with the repository.
      Specified by:
      setRepositoryMethodMetadata in interface JpaRepositoryConfigurationAware
      Parameters:
      metadata - must not be null.
    • setProjectionFactory

      public void setProjectionFactory(ProjectionFactory projectionFactory)
      Description copied from interface: JpaRepositoryConfigurationAware
      Configures the ProjectionFactory to be used with the repository.
      Specified by:
      setProjectionFactory in interface JpaRepositoryConfigurationAware
      Parameters:
      projectionFactory - must not be null.
    • findOne

      public Optional<T> findOne(com.querydsl.core.types.Predicate predicate)
      Specified by:
      findOne in interface QuerydslPredicateExecutor<T>
    • findAll

      public List<T> findAll(com.querydsl.core.types.Predicate predicate)
      Specified by:
      findAll in interface QuerydslPredicateExecutor<T>
    • findAll

      public List<T> findAll(com.querydsl.core.types.Predicate predicate, com.querydsl.core.types.OrderSpecifier<?>... orders)
      Specified by:
      findAll in interface QuerydslPredicateExecutor<T>
    • findAll

      public List<T> findAll(com.querydsl.core.types.Predicate predicate, Sort sort)
      Specified by:
      findAll in interface QuerydslPredicateExecutor<T>
    • findAll

      public List<T> findAll(com.querydsl.core.types.OrderSpecifier<?>... orders)
      Specified by:
      findAll in interface QuerydslPredicateExecutor<T>
    • findAll

      public Page<T> findAll(com.querydsl.core.types.Predicate predicate, Pageable pageable)
      Specified by:
      findAll in interface QuerydslPredicateExecutor<T>
    • 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:
      findBy in interface QuerydslPredicateExecutor<T>
    • count

      public long count(com.querydsl.core.types.Predicate predicate)
      Specified by:
      count in interface QuerydslPredicateExecutor<T>
    • delete

      public long delete(com.querydsl.core.types.Predicate predicate)
      Delete entities by the given Predicate by 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 - the Predicate to 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:
      exists in interface QuerydslPredicateExecutor<T>
    • createQuery

      protected com.querydsl.jpa.impl.AbstractJPAQuery<?,?> createQuery(com.querydsl.core.types.Predicate... predicate)
      Creates a new JPQLQuery for the given Predicate.
      Parameters:
      predicate -
      Returns:
      the Querydsl JPQLQuery.
    • createCountQuery

      protected com.querydsl.jpa.JPQLQuery<?> createCountQuery(@Nullable com.querydsl.core.types.Predicate... predicate)
      Creates a new JPQLQuery count query for the given Predicate.
      Parameters:
      predicate - , can be null.
      Returns:
      the Querydsl count JPQLQuery.