Interface CosmosRepository<T,ID extends Serializable>

Type Parameters:
T - domain type.
ID - id type.
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>, org.springframework.data.repository.CrudRepository<T,ID>
Extension of PagingAndSortingRepository to provide additional methods to retrieve entities using the pagination and sorting abstraction.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    deleteById(ID id, com.azure.cosmos.models.PartitionKey partitionKey)
    Deletes an entity by its id and partition key.
    findAll(com.azure.cosmos.models.PartitionKey partitionKey)
    Returns list of items in a specific partition
    findById(ID id, com.azure.cosmos.models.PartitionKey partitionKey)
    Retrieves an entity by its id.
    <S extends T>
    S
    save(ID id, com.azure.cosmos.models.PartitionKey partitionKey, Class<S> domainType, com.azure.cosmos.models.CosmosPatchOperations patchOperations)
    Patches an entity by its id and partition key with CosmosPatchItemRequestOptions
    <S extends T>
    S
    save(ID id, com.azure.cosmos.models.PartitionKey partitionKey, Class<S> domainType, com.azure.cosmos.models.CosmosPatchOperations patchOperations, com.azure.cosmos.models.CosmosPatchItemRequestOptions options)
    Patches an entity by its id and partition key with CosmosPatchItemRequestOptions

    Methods inherited from interface org.springframework.data.repository.CrudRepository

    count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findAll, findAllById, findById, save, saveAll

    Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository

    findAll, findAll
  • Method Details

    • findById

      Optional<T> findById(ID id, com.azure.cosmos.models.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 - if id is null.
    • deleteById

      void deleteById(ID id, com.azure.cosmos.models.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 given id is null.
    • save

      <S extends T> S save(ID id, com.azure.cosmos.models.PartitionKey partitionKey, Class<S> domainType, com.azure.cosmos.models.CosmosPatchOperations patchOperations)
      Patches an entity by its id and partition key with CosmosPatchItemRequestOptions
      Type Parameters:
      S - type class of domain type
      Parameters:
      id - must not be null
      partitionKey - must not be null
      domainType - must not be null
      patchOperations - must not be null, max operations is 10
      Returns:
      the patched entity
      Throws:
      IllegalArgumentException - in case the given id is null.
    • save

      <S extends T> S save(ID id, com.azure.cosmos.models.PartitionKey partitionKey, Class<S> domainType, com.azure.cosmos.models.CosmosPatchOperations patchOperations, com.azure.cosmos.models.CosmosPatchItemRequestOptions options)
      Patches an entity by its id and partition key with CosmosPatchItemRequestOptions
      Type Parameters:
      S - type class of domain type
      Parameters:
      id - must not be null
      partitionKey - must not be null
      domainType - must not be null
      patchOperations - must not be null, max operations is 10
      options - Optional CosmosPatchItemRequestOptions, e.g. options.setFilterPredicate("FROM products p WHERE p.used = false");
      Returns:
      the patched entity
      Throws:
      IllegalArgumentException - in case the given id is null.
    • findAll

      Iterable<T> findAll(com.azure.cosmos.models.PartitionKey partitionKey)
      Returns list of items in a specific partition
      Parameters:
      partitionKey - partition key value
      Returns:
      Iterable of items with partition key value