Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?..

like image 445
Aron Archimowicz Avatar asked Jul 26 '26 12:07

Aron Archimowicz


1 Answers

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

like image 145
relgames Avatar answered Jul 29 '26 02:07

relgames



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!