Search code examples
spring-data-restspring-data-cassandra

How to use Spring Data for Apache Cassandra with Spring Data REST?


I have a question about Spring Data REST using with Spring Data Cassandra.

Are these two libraries able to work together? When I try to access the Spring Data REST UR it keeps asking me to provide an id field, however, in my Cassandra table there is no id field at all. I tried to go through the Spring Data REST documentation and it is not clear how to use Spring Data REST along with Spring Data Cassandra.

Consider my table like below:

@PirmaryKey
String firstName;
String lastName

Then what is my id? Can someone please give me some direction?

Thanks.


Solution

  • Spring Data Cassandra and Spring Data REST work only together if you use a single primary key column annotated with @Id. Compound primary keys are not supported by Spring Data REST and they would not map well with a {entity}/{id} URI scheme.