Using Cassandra

Cassandra is one of the supported databases that can be selected when your application is being generated.

This generator has some limitations:

  • It does not support OAuth2 authentication (we need to implement a Cassandra back-end to Spring Security's OAuth2 server)
  • We focus on Cassandra 2.0.x and not 2.1.x, as it is currently the version used by DataStax Enterprise. If you want to use Cassandra 2.1.x, please note that the CQL driver version has upgraded, you need to use V3 as the protocolVersion in your application.yml

When Cassandra is selected:

  • The Cassandra CQL driver is used to access the database. We don't use Spring Data Cassandra, as we prefer to use the driver directly. As a result, the repositories contain quite a lot of code
  • The entity sub-generator will not ask you for entity relationships, as you can't have relationships with a NoSQL database (at least not in the way you have relationships with JPA)
  • The generated entities only support one partition key, which is the ID. Future versions will provide composite primary keys and clustering keys
  • As we don't use an equivalent to Liquibase, database upgrades must be done manually. They are located in the src/main/resources/config/cql directory
  • After generating an entity, its CQL file will be generated in src/main/resources/config/cql in the same way we generate Liquibase changelogs for JPA. For running unit tests, you will need to include that changelog in the test setup, or your tests will fail as you have a missing table.