public enum LockMode extends Enum<LockMode>
Session.lock(Object, LockMode)
Enum Constant and Description |
---|
FORCE
Deprecated.
instead use PESSIMISTIC_FORCE_INCREMENT
|
NONE
No lock required.
|
OPTIMISTIC
Optimistically assume that transaction will not experience contention for
entities.
|
OPTIMISTIC_FORCE_INCREMENT
Optimistically assume that transaction will not experience contention for
entities.
|
PESSIMISTIC_FORCE_INCREMENT
Transaction will immediately increment the entity version.
|
PESSIMISTIC_READ
Implemented as PESSIMISTIC_WRITE.
|
PESSIMISTIC_WRITE
Transaction will obtain a database lock immediately.
|
READ
A shared lock.
|
UPGRADE
Deprecated.
instead use PESSIMISTIC_WRITE
|
UPGRADE_NOWAIT
Attempt to obtain an upgrade lock, using an Oracle-style
select for update nowait.
|
UPGRADE_SKIPLOCKED
Attempt to obtain an upgrade lock, using an Oracle-style
select for update skip locked.
|
WRITE
A WRITE lock is obtained when an object is updated
or inserted.
|
Modifier and Type | Method and Description |
---|---|
static LockMode |
fromExternalForm(String externalForm) |
boolean |
greaterThan(LockMode mode)
Check if this lock mode is more restrictive than the given lock mode.
|
boolean |
lessThan(LockMode mode)
Check if this lock mode is less restrictive than the given lock mode.
|
String |
toExternalForm() |
static LockMode |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static LockMode[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final LockMode NONE
public static final LockMode READ
@Deprecated public static final LockMode UPGRADE
public static final LockMode UPGRADE_NOWAIT
public static final LockMode UPGRADE_SKIPLOCKED
public static final LockMode WRITE
@Deprecated public static final LockMode FORCE
UPGRADE
except that, for versioned entities,
it results in a forced version increment.public static final LockMode OPTIMISTIC
public static final LockMode OPTIMISTIC_FORCE_INCREMENT
public static final LockMode PESSIMISTIC_READ
public static final LockMode PESSIMISTIC_WRITE
public static final LockMode PESSIMISTIC_FORCE_INCREMENT
public static LockMode[] values()
for (LockMode c : LockMode.values()) System.out.println(c);
public static LockMode valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic boolean greaterThan(LockMode mode)
mode
- LockMode to checkpublic boolean lessThan(LockMode mode)
mode
- LockMode to checkpublic String toExternalForm()
Copyright © 2016 JBoss by Red Hat. All rights reserved.