Interface CassandraRepository<T,ID>

All Superinterfaces:
org.springframework.data.repository.CrudRepository<T,ID>, org.springframework.data.repository.ListCrudRepository<T,ID>, org.springframework.data.repository.Repository<T,ID>
All Known Subinterfaces:
MapIdCassandraRepository<T>
All Known Implementing Classes:
SimpleCassandraRepository

@NoRepositoryBean public interface CassandraRepository<T,ID> extends org.springframework.data.repository.ListCrudRepository<T,ID>
Cassandra-specific extension of the CrudRepository interface that allows the specification of a type for the identity of the @Table (or @Persistable) type.

Repositories based on CassandraRepository can define either a single primary key, use a primary key class or a compound primary key without a primary key class. Types using a compound primary key without a primary key class must use MapId to declare their key value.

Author:
Alex Shvid, Matthew T. Adams, Mark Paluch
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.data.domain.Slice<T>
    findAll(org.springframework.data.domain.Pageable pageable)
    Returns a Slice of entities meeting the paging restriction provided in the Pageable object.
    <S extends T>
    List<S>
    insert(Iterable<S> entities)
    Inserts the given entities.
    <S extends T>
    S
    insert(S entity)
    Inserts the given entity.

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

    count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save

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

    findAll, saveAll
  • Method Details

    • findAllById

      List<T> findAllById(Iterable<ID> ids)

      Note: Cassandra supports single-field IN queries only. When using MapId with multiple components, use CrudRepository.findById(Object).

      Specified by:
      findAllById in interface org.springframework.data.repository.CrudRepository<T,ID>
      Specified by:
      findAllById in interface org.springframework.data.repository.ListCrudRepository<T,ID>
      Throws:
      InvalidDataAccessApiUsageException - thrown when using MapId with multiple key components.
    • findAll

      org.springframework.data.domain.Slice<T> findAll(org.springframework.data.domain.Pageable pageable)
      Returns a Slice of entities meeting the paging restriction provided in the Pageable object.
      Parameters:
      pageable - must not be null.
      Returns:
      a Slice of entities.
      Since:
      2.0
      See Also:
    • insert

      <S extends T> S insert(S entity)
      Inserts the given entity. Assumes the instance to be new to be able to apply insertion optimizations. Use the returned instance for further operations as the save operation might have changed the entity instance completely. Prefer using CrudRepository.save(Object) instead to avoid the usage of store-specific API.
      Parameters:
      entity - must not be null.
      Returns:
      the saved entity
      Since:
      2.0
    • insert

      <S extends T> List<S> insert(Iterable<S> entities)
      Inserts the given entities. Assumes the given entities to have not been persisted yet and thus will optimize the insert over a call to ListCrudRepository.saveAll(Iterable). Prefer using ListCrudRepository.saveAll(Iterable) to avoid the usage of store specific API.
      Parameters:
      entities - must not be null.
      Returns:
      the saved entities
      Since:
      2.0