Session#lock(Object, LockMode)
| Modifier and Type | Field and Description |
|---|---|
| private final String | |
| public static final LockMode | |
| private final int | |
| public static final LockMode | NONE
No lock required. |
| public static final LockMode | OPTIMISTIC
Optimistically assume that transaction will not experience contention for entities. |
| public static final LockMode | OPTIMISTIC_FORCE_INCREMENT
Optimistically assume that transaction will not experience contention for entities. |
| public static final LockMode | PESSIMISTIC_FORCE_INCREMENT
Transaction will immediately increment the entity version. |
| public static final LockMode | PESSIMISTIC_READ
Implemented as PESSIMISTIC_WRITE. |
| public static final LockMode | PESSIMISTIC_WRITE
Transaction will obtain a database lock immediately. |
| public static final LockMode | READ
A shared lock. |
| public static final LockMode | UPGRADE
An upgrade lock. |
| public static final LockMode | UPGRADE_NOWAIT
Attempt to obtain an upgrade lock, using an Oracle-style select for update nowait. |
| public static final LockMode | UPGRADE_SKIPLOCKED
Attempt to obtain an upgrade lock, using an Oracle-style select for update skip locked. |
| public static final LockMode | WRITE
A WRITE lock is obtained when an object is updated or inserted. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static LockMode | |
| public boolean | Returns: true if this lock mode is more restrictive than given lock modeLockMode to check mode)Check if this lock mode is more restrictive than the given lock mode. |
| public boolean | |
| public String | |
| public static LockMode | |
| public static LockMode[] |
| externalForm | back to summary |
|---|---|
| private final String externalForm | |
| FORCE | back to summary |
|---|---|
| public static final LockMode FORCE
Deprecated instead use PESSIMISTIC_FORCE_INCREMENT Similar to | |
| level | back to summary |
|---|---|
| private final int level | |
| NONE | back to summary |
|---|---|
| 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. | |
| OPTIMISTIC | back to summary |
|---|---|
| public static final LockMode OPTIMISTIC Optimistically assume that transaction will not experience contention for entities. The entity version will be verified near the transaction end. | |
| OPTIMISTIC_FORCE_INCREMENT | back to summary |
|---|---|
| public static final LockMode OPTIMISTIC_FORCE_INCREMENT Optimistically assume that transaction will not experience contention for entities. The entity version will be verified and incremented near the transaction end. | |
| PESSIMISTIC_FORCE_INCREMENT | back to summary |
|---|---|
| public static final LockMode PESSIMISTIC_FORCE_INCREMENT Transaction will immediately increment the entity version. | |
| PESSIMISTIC_READ | back to summary |
|---|---|
| public static final LockMode PESSIMISTIC_READ Implemented as PESSIMISTIC_WRITE. TODO: introduce separate support for PESSIMISTIC_READ | |
| PESSIMISTIC_WRITE | back to summary |
|---|---|
| public static final LockMode PESSIMISTIC_WRITE Transaction will obtain a database lock immediately. TODO: add PESSIMISTIC_WRITE_NOWAIT | |
| READ | back to summary |
|---|---|
| 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 | back to summary |
|---|---|
| public static final LockMode UPGRADE
Deprecated instead use PESSIMISTIC_WRITE An upgrade lock. Objects loaded in this lock mode are materialized using an SQL select ... for update. | |
| UPGRADE_NOWAIT | back to summary |
|---|---|
| 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. | |
| UPGRADE_SKIPLOCKED | back to summary |
|---|---|
| public static final LockMode UPGRADE_SKIPLOCKED Attempt to obtain an upgrade lock, using an Oracle-style select for update skip locked. The semantics of this lock mode, once obtained, are the same as UPGRADE. | |
| WRITE | back to summary |
|---|---|
| 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). | |
| LockMode | back to summary |
|---|---|
| private LockMode(int level, String externalForm) | |
| fromExternalForm | back to summary |
|---|---|
| public static LockMode fromExternalForm(String externalForm) | |
| greaterThan | back to summary |
|---|---|
| public boolean greaterThan(LockMode mode) Check if this lock mode is more restrictive than the given lock mode.
| |
| lessThan | back to summary |
|---|---|
| public boolean lessThan(LockMode mode) Check if this lock mode is less restrictive than the given lock mode.
| |
| toExternalForm | back to summary |
|---|---|
| public String toExternalForm() | |
| valueOf | back to summary |
|---|---|
| public static LockMode valueOf(String name) | |
| values | back to summary |
|---|---|
| public static LockMode[] values() | |