Class SimpleCassandraRepository<T,ID>
java.lang.Object
org.springframework.data.cassandra.repository.support.SimpleCassandraRepository<T,ID>
- All Implemented Interfaces:
CassandraRepository<T,
,ID> CrudRepository<T,
,ID> ListCrudRepository<T,
,ID> 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()
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
- Specified by:
save
in interfaceCrudRepository<T,
ID>
-
saveAll
- Specified by:
saveAll
in interfaceCrudRepository<T,
ID> - Specified by:
saveAll
in interfaceListCrudRepository<T,
ID>
-
findById
- Specified by:
findById
in interfaceCrudRepository<T,
ID>
-
existsById
- Specified by:
existsById
in interfaceCrudRepository<T,
ID>
-
findAll
- Specified by:
findAll
in interfaceCrudRepository<T,
ID> - Specified by:
findAll
in interfaceListCrudRepository<T,
ID>
-
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 interfaceCrudRepository<T,
ID> - Specified by:
findAllById
in interfaceListCrudRepository<T,
ID>
-
count
public long count()- Specified by:
count
in interfaceCrudRepository<T,
ID>
-
deleteById
- Specified by:
deleteById
in interfaceCrudRepository<T,
ID>
-
delete
- Specified by:
delete
in interfaceCrudRepository<T,
ID>
-
deleteAllById
- Specified by:
deleteAllById
in interfaceCrudRepository<T,
ID>
-
deleteAll
- Specified by:
deleteAll
in interfaceCrudRepository<T,
ID>
-
deleteAll
public void deleteAll()- Specified by:
deleteAll
in interfaceCrudRepository<T,
ID>
-
findAll
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
-