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 TypeMethodDescriptionorg.springframework.data.domain.Slice<T>
findAll
(org.springframework.data.domain.Pageable pageable) Returns aSlice
of entities meeting the paging restriction provided in thePageable
object.findAllById
(Iterable<ID> ids) Inserts the given entities.<S extends T>
Sinsert
(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
Note: Cassandra supports single-field
IN
queries only. When usingMapId
with multiple components, useCrudRepository.findById(Object)
.- Specified by:
findAllById
in interfaceorg.springframework.data.repository.CrudRepository<T,
ID> - Specified by:
findAllById
in interfaceorg.springframework.data.repository.ListCrudRepository<T,
ID> - Throws:
org.springframework.dao.InvalidDataAccessApiUsageException
- thrown when usingMapId
with multiple key components.
-
findAll
Returns aSlice
of entities meeting the paging restriction provided in thePageable
object.- Parameters:
pageable
- must not be null.- Returns:
- a
Slice
of entities. - Since:
- 2.0
- See Also:
-
insert
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 usingCrudRepository.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
Inserts the given entities. Assumes the given entities to have not been persisted yet and thus will optimize the insert over a call toListCrudRepository.saveAll(Iterable)
. Prefer usingListCrudRepository.saveAll(Iterable)
to avoid the usage of store specific API.- Parameters:
entities
- must not be null.- Returns:
- the saved entities
- Since:
- 2.0
-