Module org.firebirdsql.jaybird
Package org.firebirdsql.jaybird.props.internal

# Class TransactionNameMapping

java.lang.Object
org.firebirdsql.jaybird.props.internal.TransactionNameMapping

@InternalApi public final class TransactionNameMapping extends Object
Mapping of transaction names to JDBC transaction code and vice versa.

Since:
  5
Author:
  Mark Rotteveel

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `TRANSACTION_NONE`
  `static final String`
  `TRANSACTION_READ_COMMITTED`
  `static final String`
  `TRANSACTION_READ_UNCOMMITTED`
  `static final String`
  `TRANSACTION_REPEATABLE_READ`
  `static final String`
  `TRANSACTION_SERIALIZABLE`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static int`
  `toIsolationLevel(String isolationLevelName)`
  Maps a transaction isolation level name to the JDBC transaction isolation level.
  `static String`
  `toIsolationLevelName(int isolationLevel)`
  Maps a JDBC transaction isolation level to a string name.
  `static String`
  `toIsolationLevelName(int isolationLevel, boolean lenient)`
  Maps a JDBC transaction isolation level to a string name.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### TRANSACTION_NONE

    public static final String TRANSACTION_NONE
    See Also:
      - Constant Field Values

  - ### TRANSACTION_READ_UNCOMMITTED

    public static final String TRANSACTION_READ_UNCOMMITTED
    See Also:
      - Constant Field Values

  - ### TRANSACTION_READ_COMMITTED

    public static final String TRANSACTION_READ_COMMITTED
    See Also:
      - Constant Field Values

  - ### TRANSACTION_REPEATABLE_READ

    public static final String TRANSACTION_REPEATABLE_READ
    See Also:
      - Constant Field Values

  - ### TRANSACTION_SERIALIZABLE

    public static final String TRANSACTION_SERIALIZABLE
    See Also:
      - Constant Field Values

- ## Method Details

  - ### toIsolationLevel

    public static int toIsolationLevel(String isolationLevelName)
    Maps a transaction isolation level name to the JDBC transaction isolation level.

    Accepted string names are `"TRANSACTION_NONE"`, `"TRANSACTION_READ_UNCOMMITTED"`, `"TRANSACTION_READ_COMMITTED"`, `"TRANSACTION_REPEATABLE_READ"`, `"TRANSACTION_SERIALIZABLE"`. To simplify mapping connection properties, the string value of the isolation level integer (e.g. `"2"` for `Connection.TRANSACTION_READ_COMMITTED`) is also accepted.

    Parameters:
      `isolationLevelName` - Transaction isolation level name or integer string (not `null`)
    Returns:
      JDBC standard isolation level value
    Throws:
      `IllegalArgumentException` - For an unknown transaction isolation level name

  - ### toIsolationLevelName

    public static String toIsolationLevelName(int isolationLevel)
    Maps a JDBC transaction isolation level to a string name.
    Parameters:
      `isolationLevel` - JDBC isolation level
    Returns:
      name of the isolation level (e.g. `"TRANSACTION_READ_COMMITTED"`)
    Throws:
      `IllegalArgumentException` - When `isolationLevel` is not a known JDBC transaction isolation level

  - ### toIsolationLevelName

    public static String toIsolationLevelName(int isolationLevel, boolean lenient)
    Maps a JDBC transaction isolation level to a string name.
    Parameters:
      `isolationLevel` - JDBC isolation level
      `lenient` - `true` return integer string for unknown values, `false` throw `IllegalArgumentException` for unknown values
    Returns:
      name of the isolation level (e.g. TRANSACTION_READ_COMMITTED), or, when `lenient` is `true`, the integer string for unknown values
    Throws:
      `IllegalArgumentException` - When `isolationLevel` is not a known JDBC transaction isolation level and `lenient` is `false`