4 Working with nonrelational data

 

This chapter covers

  • Persisting data to Cassandra
  • Data modeling in Cassandra
  • Working with document data in MongoDB

They say that variety is the spice of life.

You probably have a favorite flavor of ice cream. It’s that one flavor that you choose the most often because it satisfies that creamy craving more than any other. But most people, despite having a favorite flavor, try different flavors from time to time to mix things up.

Databases are like ice cream. For decades, the relational database has been the favorite flavor for storing data. But these days, we have more options available than ever before. So-called “NoSQL” databases (https://aws.amazon.com/nosql/) offer different concepts and structures in which data can be stored. And although the choice may still be somewhat based on taste, some databases are better suited for persisting different kinds of data than others.

Fortunately, Spring Data has you covered for many of the NoSQL databases, including MongoDB, Cassandra, Couchbase, Neo4j, Redis, and many more. And fortunately, the programming model is nearly identical, regardless of which database you choose.

4.1 Working with Cassandra repositories

4.1.1 Enabling Spring Data Cassandra

4.1.2 Understanding Cassandra data modeling

4.1.3 Mapping domain types for Cassandra persistence

4.1.4 Writing Cassandra repositories

4.2 Writing MongoDB repositories

4.2.1 Enabling Spring Data MongoDB

4.2.2 Mapping domain types to documents

4.2.3 Writing MongoDB repository interfaces

Summary