I'm working on a project where some database table fields need to be encrypted. The way this will be done is using Microsoft SQL Server built-in encryption/decryption function:
ENCRYPTBYPASSPHRASE('PASSPHRASE',‘text’)
DECRYPTBYPASSPHRASE ('12',password)
So to insert data the SQL will be like this:
insert into login_details(uid,username,password) values(1,'smith',EncryptByPassPhrase('12',’XXX’))
And to read data the SQL will be this way:
select uid,username, DECRYPTBYPASSPHRASE ('12',password) as Password from login_details
So my question is how I can I make use of this in Hibernate using my existing OR mappings? I'm using JPA Annotations. Is there an easy way to do this with JPA annotations?