Class SimpleCassandraRepository<T,ID>

java.lang.Object
org.springframework.data.cassandra.repository.support.SimpleCassandraRepository<T,ID>
All Implemented Interfaces:
CassandraRepository<T,ID>, org.springframework.data.repository.CrudRepository<T,ID>, org.springframework.data.repository.ListCrudRepository<T,ID>, org.springframework.data.repository.Repository<T,ID>

public class SimpleCassandraRepository<T,ID> extends Object implements CassandraRepository<T,ID>
Repository base implementation for Cassandra.
Author:
Alex Shvid, Matthew T. Adams, Mark Paluch, John Blum, Jens Schauder
See Also:
  • Constructor Details

  • Method Details

    • save

      public <S extends T> S save(S entity)
      Specified by:
      save in interface org.springframework.data.repository.CrudRepository<T,ID>
    • saveAll

      public <S extends T> List<S> saveAll(Iterable<S> entities)
      Specified by:
      saveAll in interface org.springframework.data.repository.CrudRepository<T,ID>
      Specified by:
      saveAll in interface org.springframework.data.repository.ListCrudRepository<T,ID>
    • findById

      public Optional<T> findById(ID id)
      Specified by:
      findById in interface org.springframework.data.repository.CrudRepository<T,ID>
    • existsById

      public boolean existsById(ID id)
      Specified by:
      existsById in interface org.springframework.data.repository.CrudRepository<T,ID>
    • findAll

      public List<T> findAll()
      Specified by:
      findAll in interface org.springframework.data.repository.CrudRepository<T,ID>
      Specified by:
      findAll in interface org.springframework.data.repository.ListCrudRepository<T,ID>
    • findAllById

      public List<T> findAllById(Iterable<ID> ids)
      Description copied from interface: CassandraRepository

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

      Specified by:
      findAllById in interface CassandraRepository<T,ID>
      Specified by:
      findAllById in interface org.springframework.data.repository.CrudRepository<T,ID>
      Specified by:
      findAllById in interface org.springframework.data.repository.ListCrudRepository<T,ID>
    • count

      public long count()
      Specified by:
      count in interface org.springframework.data.repository.CrudRepository<T,ID>
    • deleteById

      public void deleteById(ID id)
      Specified by:
      deleteById in interface org.springframework.data.repository.CrudRepository<T,ID>
    • delete

      public void delete(T entity)
      Specified by:
      delete in interface org.springframework.data.repository.CrudRepository<T,ID>
    • deleteAllById

      public void deleteAllById(Iterable<? extends ID> ids)
      Specified by:
      deleteAllById in interface org.springframework.data.repository.CrudRepository<T,ID>
    • deleteAll

      public void deleteAll(Iterable<? extends T> entities)
      Specified by:
      deleteAll in interface org.springframework.data.repository.CrudRepository<T,ID>
    • deleteAll

      public void deleteAll()
      Specified by:
      deleteAll in interface org.springframework.data.repository.CrudRepository<T,ID>
    • findAll

      public org.springframework.data.domain.Slice<T> findAll(org.springframework.data.domain.Pageable pageable)
      Description copied from interface: CassandraRepository
      Returns a Slice of entities meeting the paging restriction provided in the Pageable object.
      Specified by:
      findAll in interface CassandraRepository<T,ID>
      Parameters:
      pageable - must not be null.
      Returns:
      a Slice of entities.
      See Also:
    • insert

      public <S extends T> S insert(S entity)
      Description copied from interface: CassandraRepository
      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.
      Specified by:
      insert in interface CassandraRepository<T,ID>
      Parameters:
      entity - must not be null.
      Returns:
      the saved entity
    • insert

      public <S extends T> List<S> insert(Iterable<S> entities)
      Description copied from interface: CassandraRepository
      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.
      Specified by:
      insert in interface CassandraRepository<T,ID>
      Parameters:
      entities - must not be null.
      Returns:
      the saved entities