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

I am using spring-data-cassandra 1.1.2.RELEASE to map objects from and to Cassandra DB via spring data repositories. I have a specific requirement that the password class attribute must be encrypted in the database and must be decrypted when the data is loaded from the database.

We did this before using spring-data-mongo and adding custom event listeners via AbstractMongoEventListener

, where we use jasypt to encrypt / decrypt just before and after the object is read / written to the database.

We tried to use some event listeners for Cassandra if they exist. In the meantime, we found that a possible solution is to use custom converters, but there is not enough documentation in this regard (sections 5.8.1-5.8.9 in 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 do this? ..

+3


source to share


1 answer


An alternative solution is to add an extra layer like DAO and separate Cassandra objects from the objects you are using in memory.



+1


source







All Articles