问题描述
我刚刚更新到Hibernate 4.0,并看到警告消息:
I have just updated to Hibernate 4.0 and am seeing the warning message :
HHH000387: ResultSet's statement was not registered
在我的日志文件中.这是什么意思,我应该担心吗?
in my log files. What does this mean, and should I be worried?
推荐答案
此日志消息是ResultSet.getStatement()
不返回最初要求创建ResultSet
的Statement
的标志. (这也可能表示内存泄漏.)使用JDBC包装器时可能会发生这种情况,因为有两个Statement
对象:包装器/装饰器和基础的Statement
.
This log message is a sign that ResultSet.getStatement()
doesn't return the Statement
which was originally asked to create the ResultSet
. (It may also indicate a memory leak.) This can happen when using a JDBC wrapper, because there are two Statement
objects: a wrapper/decorator and the underlying Statement
.
在我的项目中,我有自己的JDBC包装器用于测试.我通过确保getStatement()
返回原始Statement
代理(不是一个新的代理),而不是委派给基础的ResultSet
(它将返回),在我的ResultSet
包装器中修复了此警告基础Statement
).
In my project, I have my own JDBC wrapper for testing. I fixed this warning in my ResultSet
wrapper by ensuring that getStatement()
returns the original Statement
proxy (not a new proxy), rather than delegating to the underlying ResultSet
(which would return the underlying Statement
).
任何产生类似警告的JDBC包装器都可能使用类似的修复程序. (类似的问题和修复可能适用于方法Statement.getConnection()
.)
Any JDBC wrapper which is producing similar warnings could probably use a similar fix. (A similar problem and fix may apply to the method Statement.getConnection()
.)
顺便说一下,这里有一个针对此日志记录的错误报告: https://hibernate. atlassian.net/browse/HHH-8210
By the way, there is a bug report for this logging here: https://hibernate.atlassian.net/browse/HHH-8210
这篇关于HHH000387休眠警告是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!