public class SimpleCosmosRepository<T,ID extends Serializable> extends Object implements CosmosRepository<T,ID>
| Constructor and Description |
|---|
SimpleCosmosRepository(CosmosEntityInformation<T,ID> metadata,
CosmosOperations dbOperations)
Initialization
|
| Modifier and Type | Method and Description |
|---|---|
long |
count()
return count of documents in one container without partitions
|
void |
delete(T entity)
delete one document per entity
|
void |
deleteAll()
delete all the domains of a container
|
void |
deleteAll(Iterable<? extends T> entities)
delete list of entities without partitions
|
void |
deleteAllById(Iterable<? extends ID> ids) |
void |
deleteById(ID id)
delete one document per id without configuring partition key value
|
void |
deleteById(ID id,
PartitionKey partitionKey)
Deletes an entity by its id and partition key.
|
boolean |
existsById(ID primaryKey)
check if an entity exists per id without partition
|
Iterable<T> |
findAll()
find all entities from one container without configuring partition key value
|
org.springframework.data.domain.Page<T> |
findAll(org.springframework.data.domain.Pageable pageable)
FindQuerySpecGenerator Returns a Page of entities meeting the paging restriction provided in the Pageable
object.
|
Iterable<T> |
findAll(PartitionKey partitionKey)
Returns list of items in a specific partition
|
Iterable<T> |
findAll(org.springframework.data.domain.Sort sort)
Returns all entities sorted by the given options.
|
Iterable<T> |
findAllById(Iterable<ID> ids)
find entities based on id list from one container without partitions
|
Optional<T> |
findById(ID id)
find one entity per id without partitions
|
Optional<T> |
findById(ID id,
PartitionKey partitionKey)
Retrieves an entity by its id.
|
<S extends T> |
save(S entity)
save entity without partition
|
<S extends T> |
saveAll(Iterable<S> entities)
batch save entities
|
public SimpleCosmosRepository(CosmosEntityInformation<T,ID> metadata, CosmosOperations dbOperations)
metadata - for cosmos entity informationdbOperations - for cosmosDB operationpublic <S extends T> S save(S entity)
save in interface org.springframework.data.repository.CrudRepository<T,ID>S - type of entityentity - to be savedpublic <S extends T> Iterable<S> saveAll(Iterable<S> entities)
saveAll in interface org.springframework.data.repository.CrudRepository<T,ID>S - type of entitiesentities - Batch entitiespublic Iterable<T> findAll()
findAll in interface org.springframework.data.repository.CrudRepository<T,ID>public Iterable<T> findAllById(Iterable<ID> ids)
findAllById in interface org.springframework.data.repository.CrudRepository<T,ID>ids - id list used to find entitiespublic Optional<T> findById(ID id)
findById in interface org.springframework.data.repository.CrudRepository<T,ID>id - an id used to find entitypublic Optional<T> findById(ID id, PartitionKey partitionKey)
CosmosRepositoryfindById in interface CosmosRepository<T,ID extends Serializable>id - must not be null.partitionKey - partition key value of entity, must not be null.public long count()
count in interface org.springframework.data.repository.CrudRepository<T,ID>public void deleteById(ID id)
deleteById in interface org.springframework.data.repository.CrudRepository<T,ID>id - an id used to specify the deleted documentpublic void deleteById(ID id, PartitionKey partitionKey)
CosmosRepositorydeleteById in interface CosmosRepository<T,ID extends Serializable>id - must not be null.partitionKey - partition key value of the entity, must not be null.public void delete(T entity)
delete in interface org.springframework.data.repository.CrudRepository<T,ID>entity - the entity used to specify a documentpublic void deleteAllById(Iterable<? extends ID> ids)
deleteAllById in interface org.springframework.data.repository.CrudRepository<T,ID>public void deleteAll()
deleteAll in interface org.springframework.data.repository.CrudRepository<T,ID>public void deleteAll(Iterable<? extends T> entities)
deleteAll in interface org.springframework.data.repository.CrudRepository<T,ID>entities - list of entities to be deletedpublic boolean existsById(ID primaryKey)
existsById in interface org.springframework.data.repository.CrudRepository<T,ID>primaryKey - an id to specify an entitypublic Iterable<T> findAll(@NonNull org.springframework.data.domain.Sort sort)
findAll in interface org.springframework.data.repository.PagingAndSortingRepository<T,ID extends Serializable>sort - the Sort option for queries.public org.springframework.data.domain.Page<T> findAll(org.springframework.data.domain.Pageable pageable)
findAll in interface org.springframework.data.repository.PagingAndSortingRepository<T,ID extends Serializable>pageable - the Pageable object providing paging restrictionpublic Iterable<T> findAll(PartitionKey partitionKey)
CosmosRepositoryfindAll in interface CosmosRepository<T,ID extends Serializable>partitionKey - partition key valueVisit the Azure for Java Developers site for more Java documentation, including quick starts, tutorials, and code samples.