Package org.h2.engine

Enum IsolationLevel

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<IsolationLevel>

    public enum IsolationLevel
    extends java.lang.Enum<IsolationLevel>
    Level of isolation.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      READ_COMMITTED
      Dirty reads aren't allowed; non-repeatable reads and phantom reads are allowed.
      READ_UNCOMMITTED
      Dirty reads, non-repeatable reads and phantom reads are allowed.
      REPEATABLE_READ
      Dirty reads and non-repeatable reads aren't allowed; phantom reads are allowed.
      SERIALIZABLE
      Dirty reads, non-repeatable reads and phantom reads are'n allowed.
      SNAPSHOT
      Dirty reads, non-repeatable reads and phantom reads are'n allowed.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int jdbc  
      private int lockMode  
      private java.lang.String sql  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private IsolationLevel​(int jdbc, int lockMode)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean allowNonRepeatableRead()
      Returns whether a non-repeatable read phenomena is allowed.
      static IsolationLevel fromJdbc​(int level)
      Returns the isolation level from LOCK_MODE equivalent for PageStore and old versions of H2.
      static IsolationLevel fromLockMode​(int lockMode)
      Returns the isolation level from LOCK_MODE equivalent for PageStore and old versions of H2.
      static IsolationLevel fromSql​(java.lang.String sql)
      Returns the isolation level from its SQL name.
      int getJdbc()
      Returns the JDBC constant for this isolation level.
      int getLockMode()
      Returns the LOCK_MODE equivalent for PageStore and old versions of H2.
      java.lang.String getSQL()
      Returns the SQL representation of this isolation level.
      static IsolationLevel valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static IsolationLevel[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • READ_UNCOMMITTED

        public static final IsolationLevel READ_UNCOMMITTED
        Dirty reads, non-repeatable reads and phantom reads are allowed.
      • READ_COMMITTED

        public static final IsolationLevel READ_COMMITTED
        Dirty reads aren't allowed; non-repeatable reads and phantom reads are allowed.
      • REPEATABLE_READ

        public static final IsolationLevel REPEATABLE_READ
        Dirty reads and non-repeatable reads aren't allowed; phantom reads are allowed.
      • SNAPSHOT

        public static final IsolationLevel SNAPSHOT
        Dirty reads, non-repeatable reads and phantom reads are'n allowed.
      • SERIALIZABLE

        public static final IsolationLevel SERIALIZABLE
        Dirty reads, non-repeatable reads and phantom reads are'n allowed. Concurrent and serial execution of transactions with this isolation level should have the same effect.
    • Field Detail

      • sql

        private final java.lang.String sql
      • jdbc

        private final int jdbc
      • lockMode

        private final int lockMode
    • Constructor Detail

      • IsolationLevel

        private IsolationLevel​(int jdbc,
                               int lockMode)
    • Method Detail

      • values

        public static IsolationLevel[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (IsolationLevel c : IsolationLevel.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static IsolationLevel valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • fromJdbc

        public static IsolationLevel fromJdbc​(int level)
        Returns the isolation level from LOCK_MODE equivalent for PageStore and old versions of H2.
        Parameters:
        level - the LOCK_MODE value
        Returns:
        the isolation level
      • fromLockMode

        public static IsolationLevel fromLockMode​(int lockMode)
        Returns the isolation level from LOCK_MODE equivalent for PageStore and old versions of H2.
        Parameters:
        lockMode - the LOCK_MODE value
        Returns:
        the isolation level
      • fromSql

        public static IsolationLevel fromSql​(java.lang.String sql)
        Returns the isolation level from its SQL name.
        Parameters:
        sql - the SQL name
        Returns:
        the isolation level from its SQL name
      • getSQL

        public java.lang.String getSQL()
        Returns the SQL representation of this isolation level.
        Returns:
        SQL representation of this isolation level
      • getJdbc

        public int getJdbc()
        Returns the JDBC constant for this isolation level.
        Returns:
        the JDBC constant for this isolation level
      • getLockMode

        public int getLockMode()
        Returns the LOCK_MODE equivalent for PageStore and old versions of H2.
        Returns:
        the LOCK_MODE equivalent
      • allowNonRepeatableRead

        public boolean allowNonRepeatableRead()
        Returns whether a non-repeatable read phenomena is allowed.
        Returns:
        whether a non-repeatable read phenomena is allowed