why native sql query can't run in hibernate and got exception

283 views Asked by At

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");
0

There are 0 answers