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>
Repository base implementation for Cassandra.
- Author:
- Alex Shvid, Matthew T. Adams, Mark Paluch, John Blum, Jens Schauder
- See Also:
-
Constructor Summary
ConstructorDescriptionSimpleCassandraRepository
(CassandraEntityInformation<T, ID> metadata, CassandraOperations operations) Create a newSimpleCassandraRepository
for the givenCassandraEntityInformation
andCassandraTemplate
. -
Method Summary
Modifier and TypeMethodDescriptionlong
count()
void
void
void
void
deleteAllById
(Iterable<? extends ID> ids) void
deleteById
(ID id) boolean
existsById
(ID id) findAll()
org.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.<S extends T>
Ssave
(S entity)
-
Constructor Details
-
SimpleCassandraRepository
public SimpleCassandraRepository(CassandraEntityInformation<T, ID> metadata, CassandraOperations operations) Create a newSimpleCassandraRepository
for the givenCassandraEntityInformation
andCassandraTemplate
.- Parameters:
metadata
- must not be null.operations
- must not be null.
-
-
Method Details
-
save
-
saveAll
-
findById
-
existsById
-
findAll
-
findAllById
Description copied from interface:CassandraRepository
Note: Cassandra supports single-field
IN
queries only. When usingMapId
with multiple components, useCrudRepository.findById(Object)
.- Specified by:
findAllById
in interfaceCassandraRepository<T,
ID> - Specified by:
findAllById
in interfaceorg.springframework.data.repository.CrudRepository<T,
ID> - Specified by:
findAllById
in interfaceorg.springframework.data.repository.ListCrudRepository<T,
ID>
-
count
public long count() -
deleteById
-
delete
-
deleteAllById
-
deleteAll
-
deleteAll
public void deleteAll() -
findAll
public org.springframework.data.domain.Slice<T> findAll(org.springframework.data.domain.Pageable pageable) Description copied from interface:CassandraRepository
Returns aSlice
of entities meeting the paging restriction provided in thePageable
object.- Specified by:
findAll
in interfaceCassandraRepository<T,
ID> - Parameters:
pageable
- must not be null.- Returns:
- a
Slice
of entities. - See Also:
-
insert
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 usingCrudRepository.save(Object)
instead to avoid the usage of store-specific API.- Specified by:
insert
in interfaceCassandraRepository<T,
ID> - Parameters:
entity
- must not be null.- Returns:
- the saved entity
-
insert
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 toListCrudRepository.saveAll(Iterable)
. Prefer usingListCrudRepository.saveAll(Iterable)
to avoid the usage of store specific API.- Specified by:
insert
in interfaceCassandraRepository<T,
ID> - Parameters:
entities
- must not be null.- Returns:
- the saved entities
-