HHH-17887 Release mode After Statment with deferred result set access does not work

This commit is contained in:
Andrea Boriero 2024-04-04 17:56:21 +02:00 committed by Andrea Boriero
parent 638b5c7394
commit 2bfa6df7cc
2 changed files with 68 additions and 69 deletions

View File

@ -182,6 +182,7 @@ public class OutputsImpl implements Outputs {
executionContext executionContext
); );
try {
//noinspection unchecked //noinspection unchecked
final RowReader<Object> rowReader = (RowReader<Object>) ResultsHelper.createRowReader( final RowReader<Object> rowReader = (RowReader<Object>) ResultsHelper.createRowReader(
executionContext, executionContext,
@ -251,6 +252,10 @@ public class OutputsImpl implements Outputs {
jdbcValues.finishUp( this.context.getSession() ); jdbcValues.finishUp( this.context.getSession() );
} }
} }
finally {
jdbcValues.finishUp( this.context.getSession() );
}
}
private SessionFactoryImplementor getSessionFactory() { private SessionFactoryImplementor getSessionFactory() {
return context.getSession().getFactory(); return context.getSession().getFactory();

View File

@ -253,7 +253,6 @@ public class DeferredResultSetAccess extends AbstractResultSetAccess {
skipRows( resultSet ); skipRows( resultSet );
logicalConnection.getResourceRegistry().register( resultSet, preparedStatement ); logicalConnection.getResourceRegistry().register( resultSet, preparedStatement );
} }
catch (SQLException e) { catch (SQLException e) {
try { try {
@ -267,9 +266,6 @@ public class DeferredResultSetAccess extends AbstractResultSetAccess {
"JDBC exception executing SQL [" + finalSql + "]" "JDBC exception executing SQL [" + finalSql + "]"
); );
} }
finally {
logicalConnection.afterStatement();
}
} }
private JdbcSessionContext context() { private JdbcSessionContext context() {
@ -324,20 +320,18 @@ public class DeferredResultSetAccess extends AbstractResultSetAccess {
@Override @Override
public void release() { public void release() {
final LogicalConnectionImplementor logicalConnection = getPersistenceContext().getJdbcCoordinator()
.getLogicalConnection();
if ( resultSet != null ) { if ( resultSet != null ) {
getPersistenceContext().getJdbcCoordinator() logicalConnection.getResourceRegistry().release( resultSet, preparedStatement );
.getLogicalConnection()
.getResourceRegistry()
.release( resultSet, preparedStatement );
resultSet = null; resultSet = null;
} }
if ( preparedStatement != null ) { if ( preparedStatement != null ) {
getPersistenceContext().getJdbcCoordinator() logicalConnection.getResourceRegistry().release( preparedStatement );
.getLogicalConnection()
.getResourceRegistry()
.release( preparedStatement );
preparedStatement = null; preparedStatement = null;
} }
logicalConnection.afterStatement();
} }
} }