public enum IsolationLevel extends java.lang.Enum<IsolationLevel>
READ_COMMITTED
or
REPEATABLE_READ
by default. Forcing a lower level, like
READ_COMMITTED
, is useful when performing a long cursor
iteration. It releases locks during iteration rather than holding on to them
until the transaction exits.
SNAPSHOT
isolation is special in that it uses multiversion
concurrency control (MVCC). A commit may fail with an OptimisticLockException
. Few repositories are expected to support this
level, however.
Repository.enterTransaction(IsolationLevel)
,
Transaction
Enum Constant and Description |
---|
NONE
Indicates that no actual transaction is in progress.
|
READ_COMMITTED
Indicates that dirty reads are prevented.
|
READ_UNCOMMITTED
Indicates that dirty reads, non-repeatable reads and phantom reads can
occur.
|
REPEATABLE_READ
Indicates that dirty reads and non-repeatable reads are prevented.
|
SERIALIZABLE
Indicates that dirty reads, non-repeatable reads and phantom reads are
prevented.
|
SNAPSHOT
Indicates that dirty reads, non-repeatable reads and phantom reads are
prevented.
|
Modifier and Type | Method and Description |
---|---|
IsolationLevel |
highestCommon(IsolationLevel level)
Returns the highest common isolation level between this and the one
given.
|
boolean |
isAtLeast(IsolationLevel level)
Returns true if this isolation level is at least as high as the one
given.
|
boolean |
isAtMost(IsolationLevel level)
Returns true if this isolation level is no higher than the one given.
|
IsolationLevel |
lowestCommon(IsolationLevel level)
Returns the lowest common isolation level between this and the one
given.
|
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.
|
public static final IsolationLevel NONE
public static final IsolationLevel READ_UNCOMMITTED
This level is also known as degree 1 isolation.
public static final IsolationLevel READ_COMMITTED
This level is also known as degree 2 isolation.
public static final IsolationLevel REPEATABLE_READ
public static final IsolationLevel SNAPSHOT
public static final IsolationLevel SERIALIZABLE
This level is also known as degree 3 isolation.
public static IsolationLevel[] values()
for (IsolationLevel c : IsolationLevel.values()) System.out.println(c);
public static IsolationLevel valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant
with the specified namejava.lang.NullPointerException
- if the argument is nullpublic boolean isAtLeast(IsolationLevel level)
public boolean isAtMost(IsolationLevel level)
public IsolationLevel lowestCommon(IsolationLevel level)
public IsolationLevel highestCommon(IsolationLevel level)
Copyright © 2006-2013 Amazon Technologies, Inc.. All Rights Reserved.