5. Cassandra repositories

5.1 Introduction

This chapter will point out the specialties for repository support for Cassandra. This builds on the core repository support explained in Chapter 3, Working with Spring Data Repositories. So make sure you've got a sound understanding of the basic concepts explained there.

5.2 Usage

To access domain entities stored in a Cassandra you can leverage our sophisticated repository support that eases implementing those quite significantly. To do so, simply create an interface for your repository:


5.3 Query methods

5.3.1 Repository delete queries

5.4 Miscellaneous

5.4.1 CDI Integration

The Spring Data Cassandra CDI extension will pick up the CassandraTemplate available as CDI bean and create a proxy for a Spring Data repository whenever an bean of a repository type is requested by the container. Thus obtaining an instance of a Spring Data repository is a matter of declaring an @Inject-ed property:

class RepositoryClient {

  PersonRepository repository;

  public void businessMethod() {

    List<Person> people = repository.findAll();