Interface CosmosRepository<T,ID extends Serializable>
-
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<T,ID>,org.springframework.data.repository.PagingAndSortingRepository<T,ID>,org.springframework.data.repository.Repository<T,ID>
- All Known Implementing Classes:
SimpleCosmosRepository
@NoRepositoryBean public interface CosmosRepository<T,ID extends Serializable> extends org.springframework.data.repository.PagingAndSortingRepository<T,ID>Extension ofPagingAndSortingRepositoryto provide additional methods to retrieve entities using the pagination and sorting abstraction.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddeleteById(ID id, PartitionKey partitionKey)Deletes an entity by its id and partition key.Iterable<T>findAll(PartitionKey partitionKey)Returns list of items in a specific partitionOptional<T>findById(ID id, PartitionKey partitionKey)Retrieves an entity by its id.
-
-
-
Method Detail
-
findById
Optional<T> findById(ID id, PartitionKey partitionKey)
Retrieves an entity by its id.- Parameters:
id- must not be null.partitionKey- partition key value of entity, must not be null.- Returns:
- the entity with the given id or Optional#empty() if none found
- Throws:
IllegalArgumentException- ifidis null.
-
deleteById
void deleteById(ID id, PartitionKey partitionKey)
Deletes an entity by its id and partition key.- Parameters:
id- must not be null.partitionKey- partition key value of the entity, must not be null.- Throws:
IllegalArgumentException- in case the givenidis null.
-
findAll
Iterable<T> findAll(PartitionKey partitionKey)
Returns list of items in a specific partition- Parameters:
partitionKey- partition key value- Returns:
- Iterable of items with partition key value
-
-