"Could not close a JDBC result set" output very often

Description

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 );
}
}

Attachments

2

Activity

Brett MeyerMarch 7, 2014 at 5:30 PM

Bulk closing rejected tickets in "resolved" state.

Former userJanuary 10, 2012 at 9:26 AM

I created a unit test using hibernate4 (see attachment). This test case calls frequently the DbTimestamp.seed() method and the memory usage seems to be constant. The test case came with a H2 database, but I ran it also against a Oracle 11g database with the same result.
Currently we are not planning to switch to hibernate 4 so a patch of the current 3.6.x series would be nice!

Former userJanuary 10, 2012 at 9:20 AM

Test with hibernate-core 4.0

Dirk FeufelJanuary 10, 2012 at 7:05 AM

I agree with you that it is cleaner if all associated resources are closed. If we can be sure about that (via the proxied Statement) thats fine. But what's about the 3.6.x release? Are there no further maintenance releases planned?

Steve EbersoleJanuary 9, 2012 at 5:22 PM

Dirk, well we will have to agree to disagree. I think it is far cleaner to expect that when i close a resource it should close its child resources. And as I pointed out, JDBC requires this, albeit in a limited fashion.

Out of Date

Details

Assignee

Reporter

Original estimate

Time tracking

No time logged1h remaining

Components

Affects versions

Priority

Created February 28, 2007 at 1:41 PM
Updated March 7, 2014 at 5:30 PM
Resolved January 9, 2012 at 5:21 PM