Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to annotate fields in Spring Boot and use SQL query to encrypt data

Shulou Source: shulou.com Published: 2022-06-03 07:29:30 11月23日 Update

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

Tags: Fields data comments encryption query Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Xiaomi Shulou Technology Apple Microsoft