Spring Data Document

org.springframework.data.document.mongodb.repository
Class QueryDslMongoRepository<T,ID extends Serializable>

java.lang.Object
  extended by org.springframework.data.document.mongodb.repository.SimpleMongoRepository<T,ID>
      extended by org.springframework.data.document.mongodb.repository.QueryDslMongoRepository<T,ID>
All Implemented Interfaces:
QueryDslPredicateExecutor<T>, org.springframework.data.repository.PagingAndSortingRepository<T,ID>, org.springframework.data.repository.Repository<T,ID>

public class QueryDslMongoRepository<T,ID extends Serializable>
extends SimpleMongoRepository<T,ID>
implements QueryDslPredicateExecutor<T>

Special QueryDsl based repository implementation that allows execution Predicates in various forms. TODO: Extract QueryDslMongoRepository.EntityPathResolver into Spring Data Commons TODO: Refactor Spring Data JPA to use this common infrastructure

Author:
Oliver Gierke

Nested Class Summary
static interface QueryDslMongoRepository.EntityPathResolver
          Strategy interface to abstract the ways to translate an plain domain class into a EntityPath.
 
Constructor Summary
QueryDslMongoRepository(MongoEntityInformation<T,ID> entityInformation, MongoTemplate template)
          Creates a new QueryDslMongoRepository for the given EntityMetadata and MongoTemplate.
QueryDslMongoRepository(MongoEntityInformation<T,ID> entityInformation, MongoTemplate template, QueryDslMongoRepository.EntityPathResolver resolver)
          Creates a new QueryDslMongoRepository for the given MongoEntityInformation, MongoTemplate and QueryDslMongoRepository.EntityPathResolver.
 
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.document.mongodb.repository.SimpleMongoRepository
count, delete, delete, deleteAll, exists, findAll, findAll, findAll, findAll, findOne, getEntityInformation, getMongoOperations, save, save
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryDslMongoRepository

public QueryDslMongoRepository(MongoEntityInformation<T,ID> entityInformation,
                               MongoTemplate template)
Creates a new QueryDslMongoRepository for the given EntityMetadata and MongoTemplate. Uses the SimpleEntityPathResolver to create an EntityPath for the given domain class.

Parameters:
entityInformation -
template -

QueryDslMongoRepository

public QueryDslMongoRepository(MongoEntityInformation<T,ID> entityInformation,
                               MongoTemplate template,
                               QueryDslMongoRepository.EntityPathResolver resolver)
Creates a new QueryDslMongoRepository for the given MongoEntityInformation, MongoTemplate and QueryDslMongoRepository.EntityPathResolver.

Parameters:
entityInformation -
template -
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 Document

Copyright © 2011. All Rights Reserved.