gpt4 book ai didi

java - SQL 错误 : 17059, SQLState : 99999:org. hibernate.util.JDBCExceptionReporter-[错误]:无法转换为内部表示

转载 作者:行者123 更新时间:2023-12-02 03:00:22 25 4
gpt4 key购买 nike

调用 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com