- All Known Subinterfaces:
TransactionControl,TransactionManager
- All Known Implementing Classes:
DefaultTransactionManager,LitebridgeTransactionManager,Transaction
public interface ConnectionProvider
Provides a mechanism to obtain a managed database connection, typically bound to the scope of a transaction.
This interface abstracts the underlying connection management, ensuring proper lifecycle handling of the
connection resource.
Implementations of this interface are expected to manage the allocation, reuse, and cleanup of database connections in a manner that aligns with the application's transaction and resource management strategy. Connections obtained through this interface may either participate in transactions or operate in auto-commit mode, depending on the context in which they are used.
-
Method Summary
Modifier and TypeMethodDescriptionProvides a transaction-bound managed connection to the underlying database.
-
Method Details
-
connection
Provides a transaction-bound managed connection to the underlying database.This method is typically used to execute database operations within the context of the current transaction (or not, if the connection is in auto-commit mode).
Transactions themselves (and corresponding
Connectionlifecycle methods) are managed by aTransactionManagerand are not supported by the returnedManagedConnection.- Returns:
- a
ManagedConnectioninstance representing the database connection - Throws:
SQLException- if an error occurs while obtaining the connection
-