Spring Data Jpa

org.springframework.data.jpa.repository.support
Class QueryDslJpaRepository<T,ID extends Serializable>

java.lang.Object
  extended by org.springframework.data.jpa.repository.support.SimpleJpaRepository<T,ID>
      extended by org.springframework.data.jpa.repository.support.QueryDslJpaRepository<T,ID>
All Implemented Interfaces:
JpaRepository<T,ID>, JpaSpecificationExecutor<T>, QueryDslPredicateExecutor<T>, org.springframework.data.repository.PagingAndSortingRepository<T,ID>, org.springframework.data.repository.Repository<T,ID>

public class QueryDslJpaRepository<T,ID extends Serializable>
extends SimpleJpaRepository<T,ID>
implements QueryDslPredicateExecutor<T>

QueryDsl specific extension of SimpleJpaRepository which adds implementation for QueryDslPredicateExecutor.

Author:
Oliver Gierke

Nested Class Summary
static interface QueryDslJpaRepository.EntityPathResolver
          Strategy interface to abstract the ways to translate an plain domain class into a EntityPath.
 
Constructor Summary
QueryDslJpaRepository(JpaEntityInformation<T,ID> entityMetadata, javax.persistence.EntityManager entityManager)
          Creates a new QueryDslJpaRepository from the given domain class and EntityManager.
QueryDslJpaRepository(JpaEntityInformation<T,ID> entityMetadata, javax.persistence.EntityManager entityManager, QueryDslJpaRepository.EntityPathResolver resolver)
          Creates a new QueryDslJpaRepository from the given domain class and EntityManager and uses the given QueryDslJpaRepository.EntityPathResolver to translate the domain class into an EntityPath.
 
Method Summary
 Long count(com.mysema.query.types.Predicate predicate)
          Returns the number of instances that the given Predicate will return.
 List<T> findAll(com.mysema.query.types.Predicate predicate)
          Returns all entities matching the given Predicate.
 List<T> findAll(com.mysema.query.types.Predicate predicate, com.mysema.query.types.OrderSpecifier<?>... orders)
          Returns all entities matching the given Predicate applying the given OrderSpecifiers.
 org.springframework.data.domain.Page<T> findAll(com.mysema.query.types.Predicate predicate, org.springframework.data.domain.Pageable pageable)
          Returns a Page of entities matching the given Predicate.
 T findOne(com.mysema.query.types.Predicate predicate)
          Returns a single entity matching the given Predicate.
 
Methods inherited from class org.springframework.data.jpa.repository.support.SimpleJpaRepository
count, count, delete, delete, deleteAll, deleteInBatch, exists, findAll, findAll, findAll, findAll, findAll, findOne, findOne, flush, save, save, saveAndFlush
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryDslJpaRepository

public QueryDslJpaRepository(JpaEntityInformation<T,ID> entityMetadata,
                             javax.persistence.EntityManager entityManager)
Creates a new QueryDslJpaRepository from the given domain class and EntityManager. This will use the SimpleEntityPathResolver to translate the given domain class into an EntityPath.

Parameters:
domainClass -
entityManager -

QueryDslJpaRepository

public QueryDslJpaRepository(JpaEntityInformation<T,ID> entityMetadata,
                             javax.persistence.EntityManager entityManager,
                             QueryDslJpaRepository.EntityPathResolver resolver)
Creates a new QueryDslJpaRepository from the given domain class and EntityManager and uses the given QueryDslJpaRepository.EntityPathResolver to translate the domain class into an EntityPath.

Parameters:
domainClass -
entityManager -
resolver -
Method Detail

findOne

public T findOne(com.mysema.query.types.Predicate predicate)
Description copied from interface: QueryDslPredicateExecutor
Returns a single entity matching the given Predicate.

Specified by:
findOne in interface QueryDslPredicateExecutor<T>
Returns:

findAll

public List<T> findAll(com.mysema.query.types.Predicate predicate)
Description copied from interface: QueryDslPredicateExecutor
Returns all entities matching the given Predicate.

Specified by:
findAll in interface QueryDslPredicateExecutor<T>
Returns:

findAll

public List<T> findAll(com.mysema.query.types.Predicate predicate,
                       com.mysema.query.types.OrderSpecifier<?>... orders)
Description copied from interface: QueryDslPredicateExecutor
Returns all entities matching the given Predicate applying the given OrderSpecifiers.

Specified by:
findAll in interface QueryDslPredicateExecutor<T>
Returns:

findAll

public org.springframework.data.domain.Page<T> findAll(com.mysema.query.types.Predicate predicate,
                                                       org.springframework.data.domain.Pageable pageable)
Description copied from interface: QueryDslPredicateExecutor
Returns a Page of entities matching the given Predicate.

Specified by:
findAll in interface QueryDslPredicateExecutor<T>
Returns:

count

public Long count(com.mysema.query.types.Predicate predicate)
Description copied from interface: QueryDslPredicateExecutor
Returns the number of instances that the given Predicate will return.

Specified by:
count in interface QueryDslPredicateExecutor<T>
Parameters:
predicate - the Predicate to count instances for
Returns:
the number of instances

Spring Data Jpa

Copyright © 2011 SpringSource. All Rights Reserved.