org.springframework.data.document.mongodb.repository
Class SimpleMongoRepository<T,ID extends java.io.Serializable>
java.lang.Object
org.springframework.data.document.mongodb.repository.SimpleMongoRepository<T,ID>
- Direct Known Subclasses:
- QueryDslMongoRepository
public class SimpleMongoRepository<T,ID extends java.io.Serializable>
- extends java.lang.Object
Repository base implementation for Mongo.
- Author:
- Oliver Gierke
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
template
private final MongoTemplate template
entityInformation
private final MongoEntityInformation<T,ID extends java.io.Serializable> entityInformation
SimpleMongoRepository
public SimpleMongoRepository(MongoEntityInformation<T,ID> metadata,
MongoTemplate template)
- Creates a ew
SimpleMongoRepository
for the given MongoEntityInformation
and MongoTemplate
.
- Parameters:
metadata
- template
-
save
public T save(T entity)
save
public java.util.List<T> save(java.lang.Iterable<? extends T> entities)
findOne
public T findOne(ID id)
getIdQuery
private Query getIdQuery(java.lang.Object id)
getIdCriteria
private Criteria getIdCriteria(java.lang.Object id)
exists
public boolean exists(ID id)
count
public java.lang.Long count()
delete
public void delete(T entity)
delete
public void delete(java.lang.Iterable<? extends T> entities)
deleteAll
public void deleteAll()
findAll
public java.util.List<T> findAll()
findAll
public findAll(Pageable pageable)
findAll
public java.util.List<T> findAll(Sort sort)
getMongoOperations
protected MongoOperations getMongoOperations()
- Returns the underlying
MongoOperations
instance.
- Returns:
getEntityInformation
protected MongoEntityInformation<T,ID> getEntityInformation()
- Returns:
- the entityInformation