Interface JdbcTransactionManager

All Superinterfaces:
TransactionManager
All Known Implementing Classes:
DataSourceTransactionManager

public interface JdbcTransactionManager extends TransactionManager
JDBC-specific extension of TransactionManager.

Carries the three members that only make sense against a JDBC DataSource - raw Connection access and the two connection-level knobs a transaction can tune before any statement runs. A non-JDBC backend (the JSON backend's JsonTransactionManager, for instance) implements TransactionManager directly and never has to answer these three, instead of inheriting abstract methods it can only lie about (D-04).

Framework internals that genuinely need a Connection - TransactionAwareDataSource, AbstractRelationalDataOperator - should program against this sub-interface, not against TransactionManager directly.

Since:
6.3.0
Author:
wisdomme
  • Method Details

    • getConnection

      Connection getConnection()
      Gets the current connection, creating a new one if necessary.

      If a transaction is active, returns the connection associated with it. Otherwise, returns a new connection from the data source.

      Specified by:
      getConnection in interface TransactionManager
      Returns:
      the current connection
    • setIsolationLevel

      void setIsolationLevel(int level)
      Sets the isolation level for the current transaction.

      Must be called after begin() and before any statements are executed.

      Specified by:
      setIsolationLevel in interface TransactionManager
      Parameters:
      level - the JDBC isolation level constant
    • setReadOnly

      void setReadOnly(boolean readOnly)
      Sets read-only mode for the current transaction.
      Specified by:
      setReadOnly in interface TransactionManager
      Parameters:
      readOnly - true for read-only mode