When I run the following SQL query in Hibernate I got org.hibernate.exception.GenericJDBCException: could not execute query
:
select cast(DECRYPTBYKEY(cc.EncryptCardno) as varchar(30)) as cardNo
from stmtOfAccounts s, creditCards cc
where s.creditCardId = cc.id and s.id = :stmtOfAccountId
This is the HQL:
String hqlQuery = String.format(
"select cast(DECRYPTBYKEY(cc.EncryptCardno) as varchar(30)) as cardNo " +
"from stmtOfAccounts s, creditCards cc " +
"where s.creditCardId = cc.id and s.id = :stmtOfAccountId");