spring-data-r2dbc
spring-data-r2dbc copied to clipboard
Model entity need to add custom Encryption on insert/update and decrypt on read
Hello,
Can you guys define how to implement encryption, decryption on some of Model columns by custom annotation. Or any eventListener such as Hibernate in R2DBC can use ? We can find solution for JPA but not found for R2DBC.
There's no consistent way to post-process database values before writing them to the database or after returning these and before conversion into an entity.
@mp911de does customConverter works with this requirement ? I mean just need to verify that, it won't make any issue to persist DB value, state right ?
CustomConversions uses type-based converters to e.g. apply conversion for temporal types or to serialize a custom type to bytes or JSON. We do not have sufficient hooks. While there's a BeforeSave callback, there's no way to post-process the loaded result when reading or when running a query.
Sounds good @mp911de , I checked BeforeSaveCallback is of type based conversion at table level.
May I know , does it work for annotation on Column based ?, requirement is to add encryption for some of the columns only.