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
ConstructorsConstructorDescriptionSimpleCassandraRepository(CassandraEntityInformation<T, ID> metadata, CassandraOperations operations) Create a newSimpleCassandraRepositoryfor the givenCassandraEntityInformationandCassandraTemplate. -
Method Summary
Modifier and TypeMethodDescriptionlongcount()voidvoidvoidvoiddeleteAllById(Iterable<? extends ID> ids) voiddeleteById(ID id) booleanexistsById(ID id) findAll()Returns aSliceof entities meeting the paging restriction provided in thePageableobject.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 newSimpleCassandraRepositoryfor the givenCassandraEntityInformationandCassandraTemplate.- Parameters:
metadata- must not be null.operations- must not be null.
-
-
Method Details
-
save
- Specified by:
savein interfaceCrudRepository<T,ID>
-
saveAll
- Specified by:
saveAllin interfaceCrudRepository<T,ID> - Specified by:
saveAllin interfaceListCrudRepository<T,ID>
-
findById
- Specified by:
findByIdin interfaceCrudRepository<T,ID>
-
existsById
- Specified by:
existsByIdin interfaceCrudRepository<T,ID>
-
findAll
- Specified by:
findAllin interfaceCrudRepository<T,ID> - Specified by:
findAllin interfaceListCrudRepository<T,ID>
-
findAllById
Description copied from interface:CassandraRepositoryNote: Cassandra supports single-field
INqueries only. When usingMapIdwith multiple components, useCrudRepository.findById(Object).- Specified by:
findAllByIdin interfaceCassandraRepository<T,ID> - Specified by:
findAllByIdin interfaceCrudRepository<T,ID> - Specified by:
findAllByIdin interfaceListCrudRepository<T,ID>
-
count
public long count()- Specified by:
countin interfaceCrudRepository<T,ID>
-
deleteById
- Specified by:
deleteByIdin interfaceCrudRepository<T,ID>
-
delete
- Specified by:
deletein interfaceCrudRepository<T,ID>
-
deleteAllById
- Specified by:
deleteAllByIdin interfaceCrudRepository<T,ID>
-
deleteAll
- Specified by:
deleteAllin interfaceCrudRepository<T,ID>
-
deleteAll
public void deleteAll()- Specified by:
deleteAllin interfaceCrudRepository<T,ID>
-
findAll
Description copied from interface:CassandraRepositoryReturns aSliceof entities meeting the paging restriction provided in thePageableobject.- Specified by:
findAllin interfaceCassandraRepository<T,ID> - Parameters:
pageable- must not be null.- Returns:
- a
Sliceof entities. - See Also:
-
insert
Description copied from interface:CassandraRepositoryInserts 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:
insertin interfaceCassandraRepository<T,ID> - Parameters:
entity- must not be null.- Returns:
- the saved entity
-
insert
Description copied from interface:CassandraRepositoryInserts 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:
insertin interfaceCassandraRepository<T,ID> - Parameters:
entities- must not be null.- Returns:
- the saved entities
-