HHH-7984 Handle Oracle statements on release
This commit is contained in:
parent
1ee3be2da7
commit
dc193c32c5
|
@ -96,7 +96,7 @@ public class PessimisticReadSelectLockingStrategy extends AbstractSelectLockingS
|
|||
}
|
||||
}
|
||||
finally {
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs, st );
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
|
|
@ -95,7 +95,7 @@ public class PessimisticWriteSelectLockingStrategy extends AbstractSelectLocking
|
|||
}
|
||||
}
|
||||
finally {
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs, st );
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
|
|
@ -96,7 +96,7 @@ public class SelectLockingStrategy extends AbstractSelectLockingStrategy {
|
|||
}
|
||||
}
|
||||
finally {
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs, st );
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
|
|
@ -374,7 +374,7 @@ public class JdbcCoordinatorImpl implements JdbcCoordinator {
|
|||
LOG.tracev( "Registering result set [{0}]", resultSet );
|
||||
if ( statement == null ) {
|
||||
try {
|
||||
statement = resultSet.getStatement(); // best guess
|
||||
statement = resultSet.getStatement();
|
||||
}
|
||||
catch ( SQLException e ) {
|
||||
throw exceptionHelper.convert( e, "unable to access statement from resultset" );
|
||||
|
@ -397,14 +397,15 @@ public class JdbcCoordinatorImpl implements JdbcCoordinator {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void release(ResultSet resultSet) {
|
||||
public void release(ResultSet resultSet, Statement statement) {
|
||||
LOG.tracev( "Releasing result set [{0}]", resultSet );
|
||||
Statement statement;
|
||||
try {
|
||||
statement = resultSet.getStatement();
|
||||
}
|
||||
catch ( SQLException e ) {
|
||||
throw exceptionHelper.convert( e, "unable to access statement from resultset" );
|
||||
if ( statement == null ) {
|
||||
try {
|
||||
statement = resultSet.getStatement();
|
||||
}
|
||||
catch ( SQLException e ) {
|
||||
throw exceptionHelper.convert( e, "unable to access statement from resultset" );
|
||||
}
|
||||
}
|
||||
if ( statement != null ) {
|
||||
if ( LOG.isEnabled( Level.WARN ) && !xref.containsKey( statement ) ) {
|
||||
|
|
|
@ -184,8 +184,9 @@ public interface JdbcCoordinator extends Serializable {
|
|||
* Release a previously registered result set.
|
||||
*
|
||||
* @param resultSet The result set to release.
|
||||
* @param statement Statement from which {@link ResultSet} has been generated.
|
||||
*/
|
||||
public void release(ResultSet resultSet);
|
||||
public void release(ResultSet resultSet, Statement statement);
|
||||
|
||||
/**
|
||||
* Does this registry currently have any registered resources?
|
||||
|
|
|
@ -64,7 +64,7 @@ public class GUIDGenerator implements IdentifierGenerator {
|
|||
result = rs.getString(1);
|
||||
}
|
||||
finally {
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs, st );
|
||||
}
|
||||
LOG.guidGenerated(result);
|
||||
return result;
|
||||
|
|
|
@ -105,7 +105,7 @@ public class IdentityGenerator extends AbstractPostInsertGenerator {
|
|||
}
|
||||
finally {
|
||||
if ( rs != null ) {
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs, insert );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ public class IdentityGenerator extends AbstractPostInsertGenerator {
|
|||
);
|
||||
}
|
||||
finally {
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs, insert );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ public class IncrementGenerator implements IdentifierGenerator, Configurable {
|
|||
}
|
||||
}
|
||||
finally {
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs, st );
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
|
|
@ -128,7 +128,7 @@ public class SequenceGenerator
|
|||
return result;
|
||||
}
|
||||
finally {
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs, st );
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
|
|
@ -107,7 +107,7 @@ public class SequenceStructure implements DatabaseStructure {
|
|||
}
|
||||
finally {
|
||||
try {
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs, st );
|
||||
}
|
||||
catch( Throwable ignore ) {
|
||||
// intentionally empty
|
||||
|
|
|
@ -87,7 +87,7 @@ public abstract class AbstractSelectingDelegate implements InsertGeneratedIdenti
|
|||
return getResult( session, rs, binder.getEntity() );
|
||||
}
|
||||
finally {
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs, idSelect );
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
|
|
@ -1796,7 +1796,7 @@ public abstract class AbstractCollectionPersister
|
|||
return rs.next() ? rs.getInt( 1 ) - baseIndex : 0;
|
||||
}
|
||||
finally {
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs, st );
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
@ -1835,7 +1835,7 @@ public abstract class AbstractCollectionPersister
|
|||
return rs.next();
|
||||
}
|
||||
finally {
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs, st );
|
||||
}
|
||||
}
|
||||
catch ( TransientObjectException e ) {
|
||||
|
@ -1874,7 +1874,7 @@ public abstract class AbstractCollectionPersister
|
|||
}
|
||||
}
|
||||
finally {
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs, st );
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
|
|
@ -1278,7 +1278,7 @@ public abstract class AbstractEntityPersister
|
|||
}
|
||||
finally {
|
||||
if ( rs != null ) {
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs, ps );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1535,7 +1535,7 @@ public abstract class AbstractEntityPersister
|
|||
return values;
|
||||
}
|
||||
finally {
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs, ps );
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
@ -1586,7 +1586,7 @@ public abstract class AbstractEntityPersister
|
|||
return (Serializable) getIdentifierType().nullSafeGet( rs, getIdentifierAliases(), session, null );
|
||||
}
|
||||
finally {
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs, ps );
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
@ -1890,7 +1890,7 @@ public abstract class AbstractEntityPersister
|
|||
return getVersionType().nullSafeGet( rs, getVersionColumnName(), session, null );
|
||||
}
|
||||
finally {
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs, st );
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
@ -2910,7 +2910,7 @@ public abstract class AbstractEntityPersister
|
|||
}
|
||||
|
||||
if ( sequentialResultSet != null ) {
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( sequentialResultSet );
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( sequentialResultSet, sequentialSelect );
|
||||
}
|
||||
|
||||
return values;
|
||||
|
@ -4654,7 +4654,7 @@ public abstract class AbstractEntityPersister
|
|||
}
|
||||
finally {
|
||||
if ( rs != null ) {
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs, ps );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4753,7 +4753,7 @@ public abstract class AbstractEntityPersister
|
|||
return snapshot;
|
||||
}
|
||||
finally {
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs, ps );
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
@ -4811,7 +4811,7 @@ public abstract class AbstractEntityPersister
|
|||
return (Serializable) getIdentifierType().hydrate( rs, getIdentifierAliases(), session, null );
|
||||
}
|
||||
finally {
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
|
||||
session.getTransactionCoordinator().getJdbcCoordinator().release( rs, ps );
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
|
|
@ -132,7 +132,7 @@ public class BasicOperationsTest extends BaseCoreFunctionalTestCase {
|
|||
s.getTransactionCoordinator().getJdbcCoordinator().register(columnInfo, columnInfo.getStatement());
|
||||
assertTrue( columnInfo.next() );
|
||||
int dataType = columnInfo.getInt( "DATA_TYPE" );
|
||||
s.getTransactionCoordinator().getJdbcCoordinator().release( columnInfo );
|
||||
s.getTransactionCoordinator().getJdbcCoordinator().release( columnInfo, columnInfo.getStatement() );
|
||||
assertEquals(
|
||||
columnName,
|
||||
JdbcTypeNameMapper.getTypeName( expectedJdbcTypeCode ),
|
||||
|
|
|
@ -72,13 +72,13 @@ public class GeneralWorkTest extends BaseCoreFunctionalTestCase {
|
|||
resultSet = ((SessionImplementor)session).getTransactionCoordinator().getJdbcCoordinator().getResultSetReturn().extract( statement, "select * from T_JDBC_PERSON" );
|
||||
}
|
||||
finally {
|
||||
releaseQuietly( ((SessionImplementor)session), resultSet );
|
||||
releaseQuietly( ((SessionImplementor)session), resultSet, statement );
|
||||
}
|
||||
try {
|
||||
((SessionImplementor)session).getTransactionCoordinator().getJdbcCoordinator().getResultSetReturn().extract( statement, "select * from T_JDBC_BOAT" );
|
||||
}
|
||||
finally {
|
||||
releaseQuietly( ((SessionImplementor)session), resultSet );
|
||||
releaseQuietly( ((SessionImplementor)session), resultSet, statement );
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
@ -145,7 +145,7 @@ public class GeneralWorkTest extends BaseCoreFunctionalTestCase {
|
|||
assertEquals( 1L, personCount );
|
||||
}
|
||||
finally {
|
||||
releaseQuietly( ((SessionImplementor)session2), resultSet );
|
||||
releaseQuietly( ((SessionImplementor)session2), resultSet, statement );
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
@ -178,12 +178,12 @@ public class GeneralWorkTest extends BaseCoreFunctionalTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
private void releaseQuietly(SessionImplementor s, ResultSet resultSet) {
|
||||
private void releaseQuietly(SessionImplementor s, ResultSet resultSet, Statement statement) {
|
||||
if ( resultSet == null ) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
s.getTransactionCoordinator().getJdbcCoordinator().release( resultSet );
|
||||
s.getTransactionCoordinator().getJdbcCoordinator().release( resultSet, statement );
|
||||
}
|
||||
catch (Exception e) {
|
||||
// ignore
|
||||
|
|
|
@ -136,7 +136,7 @@ public class AutoDiscoveryTest extends BaseCoreFunctionalTestCase {
|
|||
Assert.assertFalse( "bad dialect.getColumnAliasExtractor impl", column1Alias.equals( column2Alias ) );
|
||||
}
|
||||
finally {
|
||||
sessionImplementor.getTransactionCoordinator().getJdbcCoordinator().release( rs );
|
||||
sessionImplementor.getTransactionCoordinator().getJdbcCoordinator().release( rs, ps );
|
||||
sessionImplementor.getTransactionCoordinator().getJdbcCoordinator().release( ps );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue