Interface MapIdCassandraRepository<T>
- All Superinterfaces:
CassandraRepository<T,
,MapId> org.springframework.data.repository.CrudRepository<T,
,MapId> org.springframework.data.repository.ListCrudRepository<T,
,MapId> org.springframework.data.repository.Repository<T,
MapId>
Cassandra repository interface using
MapId
to represent Ids.
This interface uses MapId
for the id type, allowing you to annotate entity fields or properties with
@PrimaryKeyColumn
. Use this interface if you do not require a composite primary key class
and want to specify the Id with MapId
.
Steps to use this interface:
- Define your entity, including a field or property for each column, including those for partition and (optional) cluster columns.
- Annotate each partition & cluster field or property with
@PrimaryKeyColumn
- Define your repository interface to be a subinterface of this interface, which uses a provided id type,
MapId
(implemented byBasicMapId
). - Whenever you need a
MapId
, you can use the static factory methodBasicMapId.id()
(which is convenient if you import statically) and the builder methodMapId.with(String, Object)
to easily construct an id. - Optionally, entity class authors can have their entities implement
MapIdentifiable
, to make it easier and quicker for entity clients to get the entity's identity.
- Since:
- 2.0
- Author:
- Matthew T. Adams, Mark Paluch
- See Also:
-
Method Summary
Methods inherited from interface org.springframework.data.cassandra.repository.CassandraRepository
findAll, findAllById, insert, insert
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