net.sourceforge.hivetranse.transaction.jdbc
Interface ConnectionsRepository

All Known Implementing Classes:
ConnectionsRepositoryImpl

public interface ConnectionsRepository

Interface implemented by the object returned by JdbcTransactionService.getCurrentTransaction. Used by ConnectionProxys to access a Connection by its id.

Generally used internally only.

Author:
Jean-Francois Poilpret

Method Summary
 void endAllConnections(boolean close, boolean commit)
          Terminate all connections enlisted in the current transaction.
 java.sql.Connection getConnection(java.lang.String id, javax.sql.DataSource ds)
          Get a Connection by its id for the current transaction (in the current thread).
 

Method Detail

getConnection

java.sql.Connection getConnection(java.lang.String id,
                                  javax.sql.DataSource ds)
                                  throws java.sql.SQLException
Get a Connection by its id for the current transaction (in the current thread). If this connection does not exist yet then it is created by the underlying DataSource and it is "enlisted" into the current transaction.

Parameters:
id - unique identifier of the Connection
ds - DataSource to be used to create new Connection if needed
Returns:
the connection for this id and the current transaction
Throws:
java.sql.SQLException

endAllConnections

void endAllConnections(boolean close,
                       boolean commit)
                       throws java.sql.SQLException
Terminate all connections enlisted in the current transaction. Used only by JdbcTransactionService.

Parameters:
close - true if connections should be closed immediately or not
commit - true if all connections should be committed before closing, false if they should be rolled back
Throws:
java.sql.SQLException