FileDocCategorySizeDatePackage
SuppliedConnectionHelper.javaAPI DocHibernate 3.2.51091Thu Feb 09 20:48:38 GMT 2006org.hibernate.tool.hbm2ddl

SuppliedConnectionHelper

public class SuppliedConnectionHelper extends Object implements ConnectionHelper
A {@link ConnectionHelper} implementation based on an explicitly supplied connection.
author
Steve Ebersole

Fields Summary
private Connection
connection
private boolean
toggleAutoCommit
Constructors Summary
public SuppliedConnectionHelper(Connection connection)

		this.connection = connection;
	
Methods Summary
public java.sql.ConnectiongetConnection()

		return connection;
	
public voidprepare(boolean needsAutoCommit)

		toggleAutoCommit = needsAutoCommit && !connection.getAutoCommit();
		if ( toggleAutoCommit ) {
			try {
				connection.commit();
			}
			catch( Throwable ignore ) {
				// might happen with a managed connection
			}
			connection.setAutoCommit( true );
		}
	
public voidrelease()

		JDBCExceptionReporter.logAndClearWarnings( connection );
		if ( toggleAutoCommit ) {
			connection.setAutoCommit( false );
		}
		connection = null;