枚举 Isolation
- java.lang.Object
- java.lang.Enum<Isolation>
- org.springframework.transaction.annotation.Isolation
- 所有已实现的接口:
Serializable
,Comparable<Isolation>
public enum Isolation extends Enum<Isolation>
Enumeration that represents transaction isolation levels for use with theTransactional
annotation, corresponding to theTransactionDefinition
interface.- 从以下版本开始:
- 1.2
- 作者:
- Colin Sampaleanu, Juergen Hoeller
枚举常量概要
枚举常量 枚举常量 说明 DEFAULT
Use the default isolation level of the underlying datastore.READ_COMMITTED
A constant indicating that dirty reads are prevented; non-repeatable reads and phantom reads can occur.READ_UNCOMMITTED
A constant indicating that dirty reads, non-repeatable reads and phantom reads can occur.REPEATABLE_READ
A constant indicating that dirty reads and non-repeatable reads are prevented; phantom reads can occur.SERIALIZABLE
A constant indicating that dirty reads, non-repeatable reads and phantom reads are prevented.
枚举常量详细资料
DEFAULT
public static final Isolation DEFAULT
Use the default isolation level of the underlying datastore. All other levels correspond to the JDBC isolation levels.- 另请参阅:
Connection
READ_UNCOMMITTED
public static final Isolation READ_UNCOMMITTED
A constant indicating that dirty reads, non-repeatable reads and phantom reads can occur. This level allows a row changed by one transaction to be read by another transaction before any changes in that row have been committed (a "dirty read"). If any of the changes are rolled back, the second transaction will have retrieved an invalid row.
READ_COMMITTED
public static final Isolation READ_COMMITTED
A constant indicating that dirty reads are prevented; non-repeatable reads and phantom reads can occur. This level only prohibits a transaction from reading a row with uncommitted changes in it.
REPEATABLE_READ
public static final Isolation REPEATABLE_READ
A constant indicating that dirty reads and non-repeatable reads are prevented; phantom reads can occur. This level prohibits a transaction from reading a row with uncommitted changes in it, and it also prohibits the situation where one transaction reads a row, a second transaction alters the row, and the first transaction rereads the row, getting different values the second time (a "non-repeatable read").
SERIALIZABLE
public static final Isolation SERIALIZABLE
A constant indicating that dirty reads, non-repeatable reads and phantom reads are prevented. This level includes the prohibitions inISOLATION_REPEATABLE_READ
and further prohibits the situation where one transaction reads all rows that satisfy aWHERE
condition, a second transaction inserts a row that satisfies thatWHERE
condition, and the first transaction rereads for the same condition, retrieving the additional "phantom" row in the second read.
方法详细资料
values
public static Isolation[] values()
按照声明该枚举类型的常量的顺序, 返回 包含这些常量的数组。该方法可用于迭代 常量, 如下所示:for (Isolation c : Isolation.values()) System.out.println(c);
- 返回:
- 按照声明该枚举类型的常量的顺序返回的包含这些常量的数组
valueOf
public static Isolation valueOf(String name)
返回带有指定名称的该类型的枚举常量。 字符串必须与用于声明该类型的枚举常量的 标识符完全匹配。(不允许有多余 的空格字符。)- 参数:
name
- 要返回的枚举常量的名称。- 返回:
- 返回带有指定名称的枚举常量
- 抛出:
IllegalArgumentException
- 如果该枚举类型没有带有指定名称的常量NullPointerException
- 如果参数为空值
value
public int value()