|
|||||||||
Home >> All >> org >> [ hibernate overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |
org.hibernate
Class LockMode

java.lang.Objectorg.hibernate.LockMode
- All Implemented Interfaces:
- java.io.Serializable
- public final class LockMode
- extends java.lang.Object
- implements java.io.Serializable
- extends java.lang.Object
Instances represent a lock mode for a row of a relational database table. It is not intended that users spend much time worrying about locking since Hibernate usually obtains exactly the right lock level automatically. Some "advanced" users may wish to explicitly specify lock levels.
Field Summary | |
static LockMode |
FORCE
Similiar to UPGRADE 55 except that, for versioned entities,
it results in a forced version increment. |
private static java.util.Map |
INSTANCES
|
private int |
level
|
private java.lang.String |
name
|
static LockMode |
NONE
No lock required. |
static LockMode |
READ
A shared lock. |
static LockMode |
UPGRADE
An upgrade lock. |
static LockMode |
UPGRADE_NOWAIT
Attempt to obtain an upgrade lock, using an Oracle-style select for update nowait. |
static LockMode |
WRITE
A WRITE lock is obtained when an object is updated or inserted. |
Constructor Summary | |
private |
LockMode(int level,
java.lang.String name)
|
Method Summary | |
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. |
static LockMode |
parse(java.lang.String name)
|
private java.lang.Object |
readResolve()
|
java.lang.String |
toString()
Convert this Object to a human-readable String. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
level
private final int level
name
private final java.lang.String name
INSTANCES
private static final java.util.Map INSTANCES
NONE
public static final LockMode NONE
- No lock required. If an object is requested with this lock
mode, a READ lock will be obtained if it is
necessary to actually read the state from the database,
rather than pull it from a cache.
This is the "default" lock mode.
READ
public static final LockMode READ
- A shared lock. Objects in this lock mode were read from
the database in the current transaction, rather than being
pulled from a cache.
UPGRADE
public static final LockMode UPGRADE
- An upgrade lock. Objects loaded in this lock mode are
materialized using an SQL select ... for update.
UPGRADE_NOWAIT
public static final LockMode UPGRADE_NOWAIT
- Attempt to obtain an upgrade lock, using an Oracle-style
select for update nowait. The semantics of
this lock mode, once obtained, are the same as
UPGRADE.
WRITE
public static final LockMode WRITE
- A WRITE lock is obtained when an object is updated
or inserted. This lock mode is for internal use only and is
not a valid mode for load() or lock() (both
of which throw exceptions if WRITE is specified).
FORCE
public static final LockMode FORCE
- Similiar to
UPGRADE
55 except that, for versioned entities, it results in a forced version increment.
Constructor Detail |
LockMode
private LockMode(int level, java.lang.String name)
Method Detail |
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object
- Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string concatenation with this object. If the result is
null
, string concatenation will instead use"null"
.The default implementation returns
getClass().getName() + "@" + Integer.toHexString(hashCode())
.
greaterThan
public boolean greaterThan(LockMode mode)
- Check if this lock mode is more restrictive than the given lock mode.
lessThan
public boolean lessThan(LockMode mode)
- Check if this lock mode is less restrictive than the given lock mode.
readResolve
private java.lang.Object readResolve()
parse
public static LockMode parse(java.lang.String name)
|
|||||||||
Home >> All >> org >> [ hibernate overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |