Getting the query in Statement Inspector after the parameters are binded.
I am following the below links for statement inspector, can the query be modified after the parameters are binded. https://vladmihalcea.com/hibernate-statementinspector/ https://stackoverflow.com/questions/39112308/how-i-can-configure-statementinspector-in-hibernate For eg:
Query q = entityManager.createNativeQuery("Select * from employees where address2_id = ?");
q.setParameter(1, address2_idval);
For the above scenario if i log the query using inspector it's printing
Select * from employees where address2_id = ?
the reason i am using inspector is sometimes address2_idval can be empty(very rare case) at that time it's generating Select * from employees where address2_id = ''
where address2_id is a numeric datatype in Db(POSTGRES).
I am getting the following error invalid input syntax for type numeric ""
.
What i am planning on implementing in inspector is if i can get Select * from employees where address2_id = ''
like this in inspector block i can check with regex and replace = '' with is null.
Can anyone pls suggest if this is possible?
NOTE: We are migrating from oracle to potgres so there are tons of queries which might face this issue, so planning on implementing in one place which intercept all the queries with this scenario