[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2455?page=c...
]
Dirk Feufel commented on HHH-2455:
----------------------------------
The problem is how I should prove that the problem still exists in 4.0. The warning
message will no longer be shown. And I could hardly write a test case that determines if
the driver left some cursor or whatever open when the ResultSet is not closed correctly.
But what I can say is that in 3.6.4 the problem still exists and can be fixed by the
provided patch. I currently do not have a 4.0 environment ready to test this issue. But
the common style (even in the 4.0 hibernate code) is:
ResultSet rs = st.executeQuery();
try {
// do something with the ResultSet
} finally {
rs.close();
}
Even if the close is a NOP I think it is cleaner code if it is called.
"Could not close a JDBC result set" output very often
-----------------------------------------------------
Key: HHH-2455
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2455
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.2.2
Reporter: Dirk Feufel
Priority: Minor
Attachments: patch-for-3.6.4.patch
Original Estimate: 1h
Remaining Estimate: 1h
If you call this type of code (like the DbTimestampType class does), the AbstractBatcher
outputs a warning "Could not close a JDBC result set".
The problem should be that closing the prepared statement internally also closes the
associated result sets and the AbstractBatcher still has a reference to this result set.
One possible solution might be to provide an additional method
public void closeStatement(PreparedStatement ps, ResultSet rs);
(as already present for closeQueryStatement) in the AbstractBatcher allowing to close
both in the right order.
PreparedStatement ps = null;
try {
ps = session.getBatcher().prepareStatement( timestampSelectString );
ResultSet rs = session.getBatcher().getResultSet( ps );
....
} finally {
if ( ps != null ) {
session.getBatcher().closeStatement( ps );
}
}
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira