Aron Archimowicz
Aron Archimowicz

Reputation: 49

Pre/post process object when saving/loading from Cassandra DB using spring-data-cassandra

I'm using spring-data-cassandra 1.1.2.RELEASE for mapping objects from and to Cassandra DB through spring data repositories. I have a particular requirement that is that a password class attribute must be encrypted in the database and must be decrypted when the data is loaded from DB.

We've done this before using spring-data-mongo and adding custom event listeners through AbstractMongoEventListener where we use jasypt to encrypt/decrypt just before and after the object is read/write to the database.

We've been trying to use some event listeners for Cassandra if they exist. On the meantime, we found that a possible solution is the use of custom converters but the documentation is scarce on that regard (the sections 5.8.1 - 5.8.9 on the documentation are empty http://docs.spring.io/spring-data/cassandra/docs/current/reference/html/#cassandra.custom-converters).

My question is, is this the best and cleanest way to do this? Where can I find examples and documentation on how to achieve this?..

Upvotes: 4

Views: 390

Answers (1)

relgames
relgames

Reputation: 1376

Alternative solution is to add an additional layer like DAO and separate Cassandra entities from entities you operate in memory.

Upvotes: 1

Related Questions