Author: steve.ebersole(a)jboss.com
Date: 2009-11-11 00:58:21 -0500 (Wed, 11 Nov 2009)
New Revision: 17954
Modified:
core/branches/Branch_3_3/core/src/main/java/org/hibernate/engine/transaction/Isolater.java
core/branches/Branch_3_3/core/src/main/java/org/hibernate/jdbc/Batcher.java
Log:
HHH-4561 - Deprecate openConnection()/closeConnection() methods on Batcher interface
Modified:
core/branches/Branch_3_3/core/src/main/java/org/hibernate/engine/transaction/Isolater.java
===================================================================
---
core/branches/Branch_3_3/core/src/main/java/org/hibernate/engine/transaction/Isolater.java 2009-11-10
21:59:05 UTC (rev 17953)
+++
core/branches/Branch_3_3/core/src/main/java/org/hibernate/engine/transaction/Isolater.java 2009-11-11
05:58:21 UTC (rev 17954)
@@ -124,14 +124,14 @@
transactionManager.begin();
}
- connection = session.getBatcher().openConnection();
+ connection = session.getFactory().getConnectionProvider().getConnection();
// perform the actual work
work.doWork( connection );
// if everything went ok, commit the transaction and close the obtained
// connection handle...
- session.getBatcher().closeConnection( connection );
+ session.getFactory().getConnectionProvider().closeConnection( connection );
if ( transacted ) {
transactionManager.commit();
@@ -144,7 +144,7 @@
caughtException = true;
try {
if ( connection != null && !connection.isClosed() ) {
- session.getBatcher().closeConnection( connection );
+ session.getFactory().getConnectionProvider().closeConnection( connection );
}
}
catch( Throwable ignore ) {
@@ -176,6 +176,7 @@
}
catch( Throwable t ) {
if ( !caughtException ) {
+ //noinspection ThrowFromFinallyBlock
throw new HibernateException( "unable to resume previously suspended
transaction", t );
}
}
@@ -199,7 +200,7 @@
Connection connection = null;
boolean wasAutoCommit = false;
try {
- connection = session.getBatcher().openConnection();
+ connection = session.getFactory().getConnectionProvider().getConnection();
if ( transacted ) {
if ( connection.getAutoCommit() ) {
@@ -248,7 +249,12 @@
log.trace( "was unable to reset connection back to auto-commit" );
}
}
- session.getBatcher().closeConnection( connection );
+ try {
+ session.getFactory().getConnectionProvider().closeConnection( connection );
+ }
+ catch ( Exception ignore ) {
+ log.info( "Unable to release isolated connection [" + ignore +
"]" );
+ }
}
}
}
Modified: core/branches/Branch_3_3/core/src/main/java/org/hibernate/jdbc/Batcher.java
===================================================================
--- core/branches/Branch_3_3/core/src/main/java/org/hibernate/jdbc/Batcher.java 2009-11-10
21:59:05 UTC (rev 17953)
+++ core/branches/Branch_3_3/core/src/main/java/org/hibernate/jdbc/Batcher.java 2009-11-11
05:58:21 UTC (rev 17954)
@@ -165,10 +165,14 @@
/**
* Obtain a JDBC connection
+ *
+ * @deprecated Obtain connections from {@link ConnectionProvider} instead
*/
public Connection openConnection() throws HibernateException;
/**
* Dispose of the JDBC connection
+ *
+ * @deprecated Obtain connections from {@link ConnectionProvider} instead
*/
public void closeConnection(Connection conn) throws HibernateException;
Show replies by date