@NoRepositoryBean public interface CrudRepository<T,ID> extends Repository<T,ID>
Modifier and Type | Method and Description |
---|---|
long |
count()
Returns the number of entities available.
|
void |
delete(T entity)
Deletes a given entity.
|
void |
deleteAll()
Deletes all entities managed by the repository.
|
void |
deleteAll(Iterable<? extends T> entities)
Deletes the given entities.
|
void |
deleteById(ID id)
Deletes the entity with the given id.
|
boolean |
existsById(ID id)
Returns whether an entity with the given id exists.
|
Iterable<T> |
findAll()
Returns all instances of the type.
|
Iterable<T> |
findAllById(Iterable<ID> ids)
Returns all instances of the type with the given IDs.
|
Optional<T> |
findById(ID id)
Retrieves an entity by its id.
|
<S extends T> |
save(S entity)
Saves a given entity.
|
<S extends T> |
saveAll(Iterable<S> entities)
Saves all given entities.
|
<S extends T> S save(S entity)
entity
- must not be null.<S extends T> Iterable<S> saveAll(Iterable<S> entities)
entities
- must not be null.IllegalArgumentException
- in case the given entity is null.Optional<T> findById(ID id)
id
- must not be null.IllegalArgumentException
- if id
is null.boolean existsById(ID id)
id
- must not be null.IllegalArgumentException
- if id
is null.Iterable<T> findAllById(Iterable<ID> ids)
ids
- long count()
void deleteById(ID id)
id
- must not be null.IllegalArgumentException
- in case the given id
is nullvoid delete(T entity)
entity
- IllegalArgumentException
- in case the given entity is null.void deleteAll(Iterable<? extends T> entities)
entities
- IllegalArgumentException
- in case the given Iterable
is null.void deleteAll()
Copyright © 2011–2018 Pivotal Software, Inc.. All rights reserved.