org.springframework.data.document.mongodb.repository
Class SimpleMongoRepository<T,ID extends java.io.Serializable>

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

public class SimpleMongoRepository<T,ID extends java.io.Serializable>
extends java.lang.Object
implements org.springframework.data.repository.PagingAndSortingRepository<T,ID>

Repository base implementation for Mongo.

Author:
Oliver Gierke

Constructor Summary
SimpleMongoRepository(MongoEntityInformation<T,ID> metadata, MongoTemplate template)
          Creates a ew SimpleMongoRepository for the given MongoEntityInformation and MongoTemplate.
 
Method Summary
 long count()
           
 void delete(ID id)
           
 void delete(java.lang.Iterable<? extends T> entities)
           
 void delete(T entity)
           
 void deleteAll()
           
 boolean exists(ID id)
           
 java.util.List<T> findAll()
           
 java.util.List<T> findAll(java.lang.Iterable<ID> ids)
           
 org.springframework.data.domain.Page<T> findAll(org.springframework.data.domain.Pageable pageable)
           
 java.util.List<T> findAll(org.springframework.data.domain.Sort sort)
           
 T findOne(ID id)
           
protected  MongoEntityInformation<T,ID> getEntityInformation()
           
protected  MongoOperations getMongoOperations()
          Returns the underlying MongoOperations instance.
 java.util.List<T> save(java.lang.Iterable<? extends T> entities)
           
 T save(T entity)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleMongoRepository

public SimpleMongoRepository(MongoEntityInformation<T,ID> metadata,
                             MongoTemplate template)
Creates a ew SimpleMongoRepository for the given MongoEntityInformation and MongoTemplate.

Parameters:
metadata -
template -
Method Detail

save

public T save(T entity)
Specified by:
save in interface org.springframework.data.repository.CrudRepository<T,ID extends java.io.Serializable>

save

public java.util.List<T> save(java.lang.Iterable<? extends T> entities)
Specified by:
save in interface org.springframework.data.repository.CrudRepository<T,ID extends java.io.Serializable>

findOne

public T findOne(ID id)
Specified by:
findOne in interface org.springframework.data.repository.CrudRepository<T,ID extends java.io.Serializable>

exists

public boolean exists(ID id)
Specified by:
exists in interface org.springframework.data.repository.CrudRepository<T,ID extends java.io.Serializable>

count

public long count()
Specified by:
count in interface org.springframework.data.repository.CrudRepository<T,ID extends java.io.Serializable>

delete

public void delete(ID id)
Specified by:
delete in interface org.springframework.data.repository.CrudRepository<T,ID extends java.io.Serializable>

delete

public void delete(T entity)
Specified by:
delete in interface org.springframework.data.repository.CrudRepository<T,ID extends java.io.Serializable>

delete

public void delete(java.lang.Iterable<? extends T> entities)
Specified by:
delete in interface org.springframework.data.repository.CrudRepository<T,ID extends java.io.Serializable>

deleteAll

public void deleteAll()
Specified by:
deleteAll in interface org.springframework.data.repository.CrudRepository<T,ID extends java.io.Serializable>

findAll

public java.util.List<T> findAll()
Specified by:
findAll in interface org.springframework.data.repository.CrudRepository<T,ID extends java.io.Serializable>

findAll

public org.springframework.data.domain.Page<T> findAll(org.springframework.data.domain.Pageable pageable)
Specified by:
findAll in interface org.springframework.data.repository.PagingAndSortingRepository<T,ID extends java.io.Serializable>

findAll

public java.util.List<T> findAll(org.springframework.data.domain.Sort sort)
Specified by:
findAll in interface org.springframework.data.repository.PagingAndSortingRepository<T,ID extends java.io.Serializable>

findAll

public java.util.List<T> findAll(java.lang.Iterable<ID> ids)

getMongoOperations

protected MongoOperations getMongoOperations()
Returns the underlying MongoOperations instance.

Returns:

getEntityInformation

protected MongoEntityInformation<T,ID> getEntityInformation()
Returns:
the entityInformation


Copyright © 2011. All Rights Reserved.