Intercepting Sql parameters before sql gets executed

Hello
I have recently implemented Encryption decryption of some user data via Hiberate EmptyInterceptor
in which i encrypted the values with the help of methods like onSave and onFlushDirty and decrypted the values via onLoad method

Now I am stuck at one case
Suppose I have a table USER with fields NAME, CONTACT_NUMBER,EMAIL

while saving the user I encrypted email and contact number

now I want to issue the following query : select * from user where contact_number = 123456789;

problem is my query is bringing no result because contact_number is encrypted in database and my query param is plain.

So I want to know a way through which I can encrypt the query params
I have used @Convert(converter = EncryptionConverter.class) this annotation but the problem is not all fields are encrypted and i want to know the entity name and field name to understand if i have to encrypt before sending it to db

Is there a way i cn make it centralised like i did encryption decryption with EmptyInterceptor

PS : kindly dont suggest inspect or onPreparedStatement of hibernate interceptor as query params are not accessbible in them. Query params comes as place holder (?)

Using a converter is your best option. You could try to ease the pain by introducing a special wrapper type e.g. EncryptedString and enable auto-apply for the conversion via @Converter(autoApply = true).