Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

HHH-7984 Handle Oracle statements on release

  • Loading branch information...
commit dc193c32c588d609ab45ff96511d5f9219fed569 1 parent 1ee3be2
@brmeyer brmeyer authored
Showing with 39 additions and 37 deletions.
  1. +1 −1  hibernate-core/src/main/java/org/hibernate/dialect/lock/PessimisticReadSelectLockingStrategy.java
  2. +1 −1  hibernate-core/src/main/java/org/hibernate/dialect/lock/PessimisticWriteSelectLockingStrategy.java
  3. +1 −1  hibernate-core/src/main/java/org/hibernate/dialect/lock/SelectLockingStrategy.java
  4. +9 −8 hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/JdbcCoordinatorImpl.java
  5. +2 −1  hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/JdbcCoordinator.java
  6. +1 −1  hibernate-core/src/main/java/org/hibernate/id/GUIDGenerator.java
  7. +2 −2 hibernate-core/src/main/java/org/hibernate/id/IdentityGenerator.java
  8. +1 −1  hibernate-core/src/main/java/org/hibernate/id/IncrementGenerator.java
  9. +1 −1  hibernate-core/src/main/java/org/hibernate/id/SequenceGenerator.java
  10. +1 −1  hibernate-core/src/main/java/org/hibernate/id/enhanced/SequenceStructure.java
  11. +1 −1  hibernate-core/src/main/java/org/hibernate/id/insert/AbstractSelectingDelegate.java
  12. +3 −3 hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java
  13. +8 −8 hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java
  14. +1 −1  hibernate-core/src/test/java/org/hibernate/test/annotations/dataTypes/BasicOperationsTest.java
  15. +5 −5 hibernate-core/src/test/java/org/hibernate/test/jdbc/GeneralWorkTest.java
  16. +1 −1  hibernate-core/src/test/java/org/hibernate/test/sql/autodiscovery/AutoDiscoveryTest.java
View
2  hibernate-core/src/main/java/org/hibernate/dialect/lock/PessimisticReadSelectLockingStrategy.java
@@ -96,7 +96,7 @@ public void lock(Serializable id, Object version, Object object, int timeout, Se
}
}
finally {
- session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
+ session.getTransactionCoordinator().getJdbcCoordinator().release( rs, st );
}
}
finally {
View
2  hibernate-core/src/main/java/org/hibernate/dialect/lock/PessimisticWriteSelectLockingStrategy.java
@@ -95,7 +95,7 @@ public void lock(Serializable id, Object version, Object object, int timeout, Se
}
}
finally {
- session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
+ session.getTransactionCoordinator().getJdbcCoordinator().release( rs, st );
}
}
finally {
View
2  hibernate-core/src/main/java/org/hibernate/dialect/lock/SelectLockingStrategy.java
@@ -96,7 +96,7 @@ public void lock(
}
}
finally {
- session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
+ session.getTransactionCoordinator().getJdbcCoordinator().release( rs, st );
}
}
finally {
View
17 hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/JdbcCoordinatorImpl.java
@@ -374,7 +374,7 @@ public void register(ResultSet resultSet, Statement statement) {
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 void register(ResultSet resultSet, Statement statement) {
}
@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 ) ) {
View
3  hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/JdbcCoordinator.java
@@ -184,8 +184,9 @@
* 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?
View
2  hibernate-core/src/main/java/org/hibernate/id/GUIDGenerator.java
@@ -64,7 +64,7 @@ public Serializable generate(SessionImplementor session, Object obj)
result = rs.getString(1);
}
finally {
- session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
+ session.getTransactionCoordinator().getJdbcCoordinator().release( rs, st );
}
LOG.guidGenerated(result);
return result;
View
4 hibernate-core/src/main/java/org/hibernate/id/IdentityGenerator.java
@@ -105,7 +105,7 @@ public Serializable executeAndExtract(PreparedStatement insert, SessionImplement
}
finally {
if ( rs != null ) {
- session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
+ session.getTransactionCoordinator().getJdbcCoordinator().release( rs, insert );
}
}
}
@@ -150,7 +150,7 @@ public Serializable executeAndExtract(PreparedStatement insert, SessionImplement
);
}
finally {
- session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
+ session.getTransactionCoordinator().getJdbcCoordinator().release( rs, insert );
}
}
View
2  hibernate-core/src/main/java/org/hibernate/id/IncrementGenerator.java
@@ -136,7 +136,7 @@ private void initializePreviousValueHolder(SessionImplementor session) {
}
}
finally {
- session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
+ session.getTransactionCoordinator().getJdbcCoordinator().release( rs, st );
}
}
finally {
View
2  hibernate-core/src/main/java/org/hibernate/id/SequenceGenerator.java
@@ -128,7 +128,7 @@ protected IntegralDataTypeHolder generateHolder(SessionImplementor session) {
return result;
}
finally {
- session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
+ session.getTransactionCoordinator().getJdbcCoordinator().release( rs, st );
}
}
finally {
View
2  hibernate-core/src/main/java/org/hibernate/id/enhanced/SequenceStructure.java
@@ -107,7 +107,7 @@ public IntegralDataTypeHolder getNextValue() {
}
finally {
try {
- session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
+ session.getTransactionCoordinator().getJdbcCoordinator().release( rs, st );
}
catch( Throwable ignore ) {
// intentionally empty
View
2  hibernate-core/src/main/java/org/hibernate/id/insert/AbstractSelectingDelegate.java
@@ -87,7 +87,7 @@ public final Serializable performInsert(
return getResult( session, rs, binder.getEntity() );
}
finally {
- session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
+ session.getTransactionCoordinator().getJdbcCoordinator().release( rs, idSelect );
}
}
finally {
View
6 hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java
@@ -1796,7 +1796,7 @@ public int getSize(Serializable key, SessionImplementor session) {
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 @@ private boolean exists(Serializable key, Object indexOrElement, Type indexOrElem
return rs.next();
}
finally {
- session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
+ session.getTransactionCoordinator().getJdbcCoordinator().release( rs, st );
}
}
catch ( TransientObjectException e ) {
@@ -1874,7 +1874,7 @@ public Object getElementByIndex(Serializable key, Object index, SessionImplement
}
}
finally {
- session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
+ session.getTransactionCoordinator().getJdbcCoordinator().release( rs, st );
}
}
finally {
View
16 hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java
@@ -1278,7 +1278,7 @@ private Object initializeLazyPropertiesFromDatastore(
}
finally {
if ( rs != null ) {
- session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
+ session.getTransactionCoordinator().getJdbcCoordinator().release( rs, ps );
}
}
}
@@ -1535,7 +1535,7 @@ public SelectFragment propertySelectFragmentFragment(
return values;
}
finally {
- session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
+ session.getTransactionCoordinator().getJdbcCoordinator().release( rs, ps );
}
}
finally {
@@ -1586,7 +1586,7 @@ public Serializable getIdByUniqueKey(Serializable key, String uniquePropertyName
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 Object getCurrentVersion(Serializable id, SessionImplementor session) thr
return getVersionType().nullSafeGet( rs, getVersionColumnName(), session, null );
}
finally {
- session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
+ session.getTransactionCoordinator().getJdbcCoordinator().release( rs, st );
}
}
finally {
@@ -2910,7 +2910,7 @@ else if ( allProperties || !laziness[i] ) {
}
if ( sequentialResultSet != null ) {
- session.getTransactionCoordinator().getJdbcCoordinator().release( sequentialResultSet );
+ session.getTransactionCoordinator().getJdbcCoordinator().release( sequentialResultSet, sequentialSelect );
}
return values;
@@ -4654,7 +4654,7 @@ private void processGeneratedProperties(
}
finally {
if ( rs != null ) {
- session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
+ session.getTransactionCoordinator().getJdbcCoordinator().release( rs, ps );
}
}
}
@@ -4753,7 +4753,7 @@ public boolean hasSubselectLoadableCollections() {
return snapshot;
}
finally {
- session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
+ session.getTransactionCoordinator().getJdbcCoordinator().release( rs, ps );
}
}
finally {
@@ -4811,7 +4811,7 @@ public Serializable loadEntityIdByNaturalId(
return (Serializable) getIdentifierType().hydrate( rs, getIdentifierAliases(), session, null );
}
finally {
- session.getTransactionCoordinator().getJdbcCoordinator().release( rs );
+ session.getTransactionCoordinator().getJdbcCoordinator().release( rs, ps );
}
}
finally {
View
2  hibernate-core/src/test/java/org/hibernate/test/annotations/dataTypes/BasicOperationsTest.java
@@ -132,7 +132,7 @@ private void validateColumn(Connection connection, String columnName, int expect
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 ),
View
10 hibernate-core/src/test/java/org/hibernate/test/jdbc/GeneralWorkTest.java
@@ -72,13 +72,13 @@ public void execute(Connection connection) throws SQLException {
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 Long execute(Connection connection) throws SQLException {
assertEquals( 1L, personCount );
}
finally {
- releaseQuietly( ((SessionImplementor)session2), resultSet );
+ releaseQuietly( ((SessionImplementor)session2), resultSet, statement );
}
}
finally {
@@ -178,12 +178,12 @@ private void releaseQuietly(SessionImplementor s, Statement statement) {
}
}
- 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
View
2  hibernate-core/src/test/java/org/hibernate/test/sql/autodiscovery/AutoDiscoveryTest.java
@@ -136,7 +136,7 @@ public void execute(Connection connection) throws SQLException {
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 );
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.