Illustration Image

user to be able to change their mail address but then it may not be part of the primary key of a Cassandra table [closed]

I use Spring Boot 2.1.x to store a user entity in a Cassandra database. This works.

  • java generated uuid
  • mail address
  • salted bcrypt password
  • some user defined types...

In case somebody uses the login I get the mail and the password to get the credentials.

For retrieving the user object I expect some where clause with select * from user where username = mail.

However, mail must be the partition key in Cassandra, but I want the user to be able to change their mail address and then it may not be part of the primary key of a Cassandra table.

My naive bad idea is to have an inverse table with a tuple (mail, java generated uuid) to look up the user and then to load the user with the uuid.

@PrimaryKeyColumn(type = PrimaryKeyType.PARTITIONED, ordinal = 0, name = "id")
@JsonProperty("id")
private String id;

@PrimaryKeyColumn(type = PrimaryKeyType.CLUSTERED, ordinal = 1, name = "email")
@Email(message = "*Please provide a valid email")
@NotEmpty(message = "*Please provide an email")
@JsonProperty("email")
private String email;
Become part of our
growing community!
Welcome to Planet Cassandra, a community for Apache Cassandra®! We're a passionate and dedicated group of users, developers, and enthusiasts who are working together to make Cassandra the best it can be. Whether you're just getting started with Cassandra or you're an experienced user, there's a place for you in our community.
A dinosaur
Planet Cassandra is a service for the Apache Cassandra® user community to share with each other. From tutorials and guides, to discussions and updates, we're here to help you get the most out of Cassandra. Connect with us and become part of our growing community today.
© 2009-2023 The Apache Software Foundation under the terms of the Apache License 2.0. Apache, the Apache feather logo, Apache Cassandra, Cassandra, and the Cassandra logo, are either registered trademarks or trademarks of The Apache Software Foundation. Sponsored by Anant Corporation and Datastax, and Developed by Anant Corporation.

Get Involved with Planet Cassandra!

We believe that the power of the Planet Cassandra community lies in the contributions of its members. Do you have content, articles, videos, or use cases you want to share with the world?