Package fr.becpg.repo.repository
Interface CrudRepository<T,ID extends Serializable>
- All Known Subinterfaces:
AlfrescoRepository<T>
- All Known Implementing Classes:
AlfrescoRepositoryImpl
public interface CrudRepository<T,ID extends Serializable>
Interface for generic CRUD operations on a repository for a specific type.
- Version:
- $Id: $Id
- Author:
- Oliver Gierke, Eberhard Wolff
-
Method Summary
Modifier and TypeMethodDescriptionlongcount()Returns the number of entities available.voidDeletes the entity with the given id.voidDeletes the given entities.voidDeletes a given entity.voidDeletes all entities managed by the repository.booleanReturns whether an entity with the given id exists.findAll()Returns all instances of the type.Retrives an entity by its primary key.Saves all given entities.Saves a given entity.
-
Method Details
-
save
Saves a given entity. Use the returned instance for further operations as the save operation might have changed the entity instance completely.- Parameters:
entity- a T object.- Returns:
- the saved entity
-
save
Saves all given entities. -
findOne
Retrives an entity by its primary key.- Parameters:
id- a ID object.- Returns:
- the entity with the given primary key or
nullif none found - Throws:
IllegalArgumentException- if primaryKey isnull
-
exists
Returns whether an entity with the given id exists.- Parameters:
id- a ID object.- Returns:
- true if an entity with the given id exists, alse otherwise
- Throws:
IllegalArgumentException- if primaryKey isnull
-
findAll
Returns all instances of the type.- Returns:
- all entities
-
count
long count()Returns the number of entities available.- Returns:
- the number of entities
-
delete
Deletes the entity with the given id.- Parameters:
id- a ID object.
-
delete
Deletes a given entity.- Parameters:
entity- a T object.
-
delete
Deletes the given entities.- Parameters:
entities- aIterableobject.
-
deleteAll
void deleteAll()Deletes all entities managed by the repository.
-