调用 API 时从下面的 hibernate 查询中获取异常。
dao类方法:
public List<ErmChangeLog> fetchChangeLog(JsonInput jsonInput) throws SQLException {
Session session = this.sessionFactory.openSession();
List<ErmChangeLog> objectList = null;
Long instanceKey = 0L;
try {
instanceKey = jsonInput.getSystematic_Risk_ID();
logger.debug("Connection creation process is completed.");
Query query = session.createQuery(CommonConstants.fetch_ChangeLog);
logger.info("query : " + CommonConstants.fetch_ChangeLog);
query.setParameter("instanceKey", instanceKey);
logger.info("instanceKey : " + instanceKey);
objectList = query.list();
} catch (Exception e) {
logger.debug("Failed to fetch Change Log");
e.printStackTrace();
throw e;
}
session.close();
return objectList;
}
查询:String fetch_ChangeLog=“from ErmChangeLog p where p.instanceKey =:instanceKey”;
异常(exception):
at java.lang.Thread.run(Thread.java:745)
[2019-07-16 16:39:10,915]:org.hibernate.util.JDBCExceptionReporter-[WARN]: SQL Error: 17059, SQLState: 99999
[2019-07-16 16:39:10,915]:org.hibernate.util.JDBCExceptionReporter-[ERROR]: Fail to convert to internal representation
[2019-07-16 16:39:10,916]:org.hibernate.jdbc.ConnectionManager-[DEBUG]: transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
最佳答案
您的参数似乎与查询所需的数据类型不匹配。您可以尝试使用 Integer 而不是 Long 吗?
关于java - SQL 错误 : 17059, SQLState : 99999:org. hibernate.util.JDBCExceptionReporter-[错误]:无法转换为内部表示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57056207/