How to annotate fields in Spring Boot and use SQL query to encrypt data
1. Comment fields:
@ Column (name = "phone", length = 100)
@ ColumnTransformer (read = "AES_DECRYPT (UNHEX (phone), 'aes_phone')", write = "HEX (AES_ENCRYPT (?,' aes_phone')")
Private String phone
2. Native SQL query encrypted data:
SELECT AES_DECRYPT (UNHEX (s.phone), 'aes_phone') FROM TABLSE s