Quarkus data encryption with hibernate @ColumnTransformer: how to read key from application.properties?

Viewed 178

I need encrypt/decrypt data with @ColumnTransformer (with Postgres DB) but I don't want an hardcoded key or store it in postgresql.conf. I am able to get the key from application.properties with:

@ConfigProperty(name = "encryptionkey")
    String key;

Unfortunately I cannot use it in @ColumnTransformer annotation because it requires a constant string. Moreover I cannot use @AttributeConverter because I need do queries with "like" and I've tried yet but it did not work. I have followed also this discussion which uses reflection for update annotation value at runtime : I would like to know if there is a way with Hibernate to perform a programmatic configuration of ColumnTransformer ? but it has not worked for me, infact I can replace the hardcoded key with "encryptionkey" when Quarkus starts but when I persists my entity, it has no effect. Can anyone help me?

Thanks in advance.

0 Answers
Related