Enum Class Isolation
- All Implemented Interfaces:
Serializable,Comparable<Isolation>,java.lang.constant.Constable
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
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionUse the default isolation level of the underlying database.Prevents dirty reads; allows non-repeatable reads and phantom reads.Allows dirty reads, non-repeatable reads, and phantom reads.Prevents dirty reads and non-repeatable reads; allows phantom reads.Prevents dirty reads, non-repeatable reads, and phantom reads. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Enum Constant Details
-
DEFAULT
Use the default isolation level of the underlying database. -
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
Prevents dirty reads; allows non-repeatable reads and phantom reads.A transaction can only read committed changes made by other transactions.
-
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
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
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
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 nameNullPointerException- if the argument is null
-
getLevel
public int getLevel()Gets the JDBC isolation level constant.- Returns:
- the isolation level, or -1 for DEFAULT
-