Enum Class DbIsolation

java.lang.Object
java.lang.Enum<DbIsolation>
cn.vonce.sql.spring.enumerate.DbIsolation
所有已实现的接口:
Serializable, Comparable<DbIsolation>, java.lang.constant.Constable

public enum DbIsolation extends Enum<DbIsolation>
作者:
Jovi
  • 嵌套类概要

    从类继承的嵌套类/接口 java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • 枚举常量概要

    枚举常量
    枚举常量
    说明
    DEFAULT为数据源(数据库)的默认隔离级别,以目前常用的MySQL为例,默认的隔离级别通常为REPEATABLE_READ
    以操作同一行数据为前提,读事务允许其他读事务和写事务,未提交的写事务禁止其他读事务和写事务。
    最低的隔离级别,一个事务能读取到别的事务未提交的更新数据,很不安全,可能出现丢失更新、脏读、不可重复读、幻读。
    保证同一事务中先后执行的多次查询将返回同一结果,不受其他事务影响。
    所有的事务依次逐个执行,这样事务之间就完全不可能产生干扰。
  • 方法概要

    修饰符和类型
    方法
    说明
    Returns the enum constant of this class with the specified name.
    static DbIsolation[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    从类继承的方法 java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • 枚举常量详细资料

    • DEFAULT

      public static final DbIsolation DEFAULT
      DEFAULT为数据源(数据库)的默认隔离级别,以目前常用的MySQL为例,默认的隔离级别通常为REPEATABLE_READ
    • READ_UNCOMMITTED

      public static final DbIsolation READ_UNCOMMITTED
      最低的隔离级别,一个事务能读取到别的事务未提交的更新数据,很不安全,可能出现丢失更新、脏读、不可重复读、幻读。
    • READ_COMMITTED

      public static final DbIsolation READ_COMMITTED
      以操作同一行数据为前提,读事务允许其他读事务和写事务,未提交的写事务禁止其他读事务和写事务。此隔离级别可以防止更新丢失、脏读,但不能防止不可重复读、幻读。此隔离级别可以通过“瞬间共享读锁”和“排他写锁”实现。
    • REPEATABLE_READ

      public static final DbIsolation REPEATABLE_READ
      保证同一事务中先后执行的多次查询将返回同一结果,不受其他事务影响。以操作同一行数据为前提,读事务禁止其他写事务,但允许其他读事务,未提交的写事务禁止其他读事务和写事务。此隔离级别可以防止更新丢失、脏读、不可重复读,但不能防止幻读。
    • SERIALIZABLE

      public static final DbIsolation SERIALIZABLE
      所有的事务依次逐个执行,这样事务之间就完全不可能产生干扰。提供严格的事务隔离,此隔离级别可以防止更新丢失、脏读、不可重复读、幻读。如果仅仅通过“行级锁”是无法实现事务序列化的,必须通过其他机制保证新插入的数据不会被刚执行查询操作的事务访问到。
  • 方法详细资料

    • values

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

      public static DbIsolation 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.)
      参数:
      name - 要返回的枚举常量的名称。
      返回:
      返回带有指定名称的枚举常量
      抛出:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - 如果参数为空值