Enum Class Isolation

java.lang.Object
java.lang.Enum<Isolation>
com.ultikits.ultitools.annotations.Isolation
All Implemented Interfaces:
Serializable, Comparable<Isolation>, java.lang.constant.Constable

public enum Isolation extends Enum<Isolation>
Enum representing transaction isolation levels.

Isolation level determines how changes made by one transaction are visible to other concurrent transactions.

Since:
6.2.0
Author:
wisdomme
  • Enum Constant Details

    • DEFAULT

      public static final Isolation DEFAULT
      Use the default isolation level of the underlying database.
    • READ_UNCOMMITTED

      public static final Isolation READ_UNCOMMITTED
      Allows dirty reads, non-repeatable reads, and phantom reads.

      Lowest isolation level. A transaction can read uncommitted changes made by other transactions.

    • READ_COMMITTED

      public static final Isolation READ_COMMITTED
      Prevents dirty reads; allows non-repeatable reads and phantom reads.

      A transaction can only read committed changes made by other transactions.

    • REPEATABLE_READ

      public static final Isolation REPEATABLE_READ
      Prevents dirty reads and non-repeatable reads; allows phantom reads.

      Ensures that if a row is read twice in a transaction, the values will be the same.

    • SERIALIZABLE

      public static final Isolation SERIALIZABLE
      Prevents dirty reads, non-repeatable reads, and phantom reads.

      Highest isolation level. Transactions are completely isolated. May significantly impact performance.

  • Field Details

    • level

      private final int level
  • Constructor Details

    • Isolation

      private Isolation(int level)
  • Method Details

    • values

      public static Isolation[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Isolation valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getLevel

      public int getLevel()
      Gets the JDBC isolation level constant.
      Returns:
      the isolation level, or -1 for DEFAULT