[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2455) "Could not close a JDBC result set" output very often
Steve Ebersole (JIRA)
noreply at atlassian.com
Mon Jan 9 08:20:12 EST 2012
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2455?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45025#comment-45025 ]
Steve Ebersole commented on HHH-2455:
-------------------------------------
Why does this have to be so difficult? Try it. Does it still happen in 4.0?
The code has significantly changed as I already said and as you said you have already seen. If you had dug a little deeper you would have seen that Hibernate proxies all JDBC resources. Which lets it do many things, specifically 2 of which can be seen in this case:
# when a {{ResultSet}} is opened from a {{Statement}}, register that {{ResultSet}} against that {{Statement}}.
# when {{Statement}} is closed, because of the above, we know all the {{ResultSet}} that need to be closed.
So please, when we ask you to verify something please just try to verify it. You sitting here arguing about how its "probably still a problem" serves no purpose.
See {{org.hibernate.engine.jdbc.spi.JdbcResourceRegistry}} and the {{org.hibernate.engine.jdbc.internal.proxy}} package if you are interested in the details of how this all works
> "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
More information about the hibernate-issues
mailing list