当我在 Hibernate 中运行以下 SQL 查询时,我得到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
这是 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");