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>, CrudRepository<T,ID>, PagingAndSortingRepository<T,ID>, 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

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, EntityPathResolver resolver)
          Creates a new QueryDslJpaRepository from the given domain class and EntityManager and uses the given EntityPathResolver to translate the domain class into an EntityPath.
 
Method Summary
protected  com.mysema.query.jpa.JPQLQuery applyPagination(com.mysema.query.jpa.JPQLQuery query, Pageable pageable)
          Applies the given Pageable to the given JPQLQuery.
protected  com.mysema.query.jpa.JPQLQuery applySorting(com.mysema.query.jpa.JPQLQuery query, Sort sort)
          Applies sorting to the given JPQLQuery.
 long count(com.mysema.query.types.Predicate predicate)
           
protected  com.mysema.query.jpa.JPQLQuery createQuery(com.mysema.query.types.Predicate... predicate)
          Creates a new JPQLQuery for the given Predicate.
 List<T> findAll(com.mysema.query.types.Predicate predicate)
           
 List<T> findAll(com.mysema.query.types.Predicate predicate, com.mysema.query.types.OrderSpecifier<?>... orders)
           
 Page<T> findAll(com.mysema.query.types.Predicate predicate, Pageable pageable)
           
 T findOne(com.mysema.query.types.Predicate predicate)
           
protected  com.mysema.query.types.OrderSpecifier<?> toOrder(Sort.Order order)
          Transforms a plain Sort.Order into a QueryDsl specific OrderSpecifier.
 
Methods inherited from class org.springframework.data.jpa.repository.support.SimpleJpaRepository
count, count, delete, delete, delete, deleteAll, deleteAllInBatch, deleteInBatch, exists, findAll, findAll, findAll, findAll, findAll, findAll, findAll, findOne, findOne, flush, save, save, saveAndFlush, setLockMetadataProvider
 
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,
                             EntityPathResolver resolver)
Creates a new QueryDslJpaRepository from the given domain class and EntityManager and uses the given 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)
Specified by:
findOne in interface QueryDslPredicateExecutor<T>

findAll

public List<T> findAll(com.mysema.query.types.Predicate predicate)
Specified by:
findAll in interface QueryDslPredicateExecutor<T>

findAll

public List<T> findAll(com.mysema.query.types.Predicate predicate,
                       com.mysema.query.types.OrderSpecifier<?>... orders)
Specified by:
findAll in interface QueryDslPredicateExecutor<T>

findAll

public Page<T> findAll(com.mysema.query.types.Predicate predicate,
                       Pageable pageable)
Specified by:
findAll in interface QueryDslPredicateExecutor<T>

count

public long count(com.mysema.query.types.Predicate predicate)
Specified by:
count in interface QueryDslPredicateExecutor<T>

createQuery

protected com.mysema.query.jpa.JPQLQuery createQuery(com.mysema.query.types.Predicate... predicate)
Creates a new JPQLQuery for the given Predicate.

Parameters:
predicate -
Returns:

applyPagination

protected com.mysema.query.jpa.JPQLQuery applyPagination(com.mysema.query.jpa.JPQLQuery query,
                                                         Pageable pageable)
Applies the given Pageable to the given JPQLQuery.

Parameters:
query -
pageable -
Returns:

applySorting

protected com.mysema.query.jpa.JPQLQuery applySorting(com.mysema.query.jpa.JPQLQuery query,
                                                      Sort sort)
Applies sorting to the given JPQLQuery.

Parameters:
query -
sort -
Returns:

toOrder

protected com.mysema.query.types.OrderSpecifier<?> toOrder(Sort.Order order)
Transforms a plain Sort.Order into a QueryDsl specific OrderSpecifier.

Parameters:
order -
Returns:

Spring Data Jpa

Copyright © 2011-2012 SpringSource. All Rights Reserved.