Enum Class Locking.Scope
- All Implemented Interfaces:
FindOption, LockOption, RefreshOption, Serializable, Comparable<Locking.Scope>, Constable
- Enclosing interface:
Locking
@Deprecated(since="7.4",
forRemoval=true)
public static enum Locking.Scope
extends Enum<Locking.Scope>
implements FindOption, LockOption, RefreshOption
Deprecated, for removal: This API element is subject to removal in a future version.
When pessimistic locking is requested, this enum defines
what exactly will be locked.
- Since:
- 7.1
- See Also:
- API Note:
- Same intention as the JPA
PessimisticLockScope, but offering the additional INCLUDE_FETCHES behavior.
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionDeprecated, for removal: This API element is subject to removal in a future version.In addition to the locking behavior specified for ROOT_ONLY, rows for collection tables (ElementCollection, OneToMany and ManyToMany) will also be locked.Deprecated, for removal: This API element is subject to removal in a future version.All tables with fetched rows will be locked.Deprecated, for removal: This API element is subject to removal in a future version.Lock the database row(s) that correspond to the non-collection-valued persistent state of that instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic Locking.ScopefromJpaScope(PessimisticLockScope scope) Deprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.The JPA PessimisticLockScope which corresponds to this Scope.static Locking.ScopeDeprecated, for removal: This API element is subject to removal in a future version.static Locking.ScopeDeprecated, for removal: This API element is subject to removal in a future version.Returns the enum constant of this class with the specified name.static Locking.Scope[]values()Deprecated, for removal: This API element is subject to removal in a future version.Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ROOT_ONLY
Deprecated, for removal: This API element is subject to removal in a future version.Lock the database row(s) that correspond to the non-collection-valued persistent state of that instance. If a joined inheritance strategy is used, or if the entity is otherwise mapped to a secondary table, this entails locking the row(s) for the entity instance in the additional table(s).- See Also:
-
INCLUDE_COLLECTIONS
Deprecated, for removal: This API element is subject to removal in a future version.In addition to the locking behavior specified for ROOT_ONLY, rows for collection tables (ElementCollection, OneToMany and ManyToMany) will also be locked.Hibernate will only lock these collection rows when they are joined. The alternatives would be to either:
-
Add joins for the collection tables, which is problematic because
- if
inner joinsare added, the results will be unexpectedly affected - if
outer joinsare added, many databases do not allow locking outer joins
- if
- Perform follow-on locking which can lead to deadlocks.
- See Also:
- API Note:
- Locking only joined rows is arguably not fully compliant with the specification. However, we believe it is the best implementation.
-
Add joins for the collection tables, which is problematic because
-
INCLUDE_FETCHES
Deprecated, for removal: This API element is subject to removal in a future version.All tables with fetched rows will be locked.- API Note:
- This is Hibernate's legacy behavior, and has no corresponding JPA scope.
-
-
Method Details
-
values
Deprecated, for removal: This API element is subject to removal in a future version.Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Deprecated, for removal: This API element is subject to removal in a future version.Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getCorrespondingJpaScope
Deprecated, for removal: This API element is subject to removal in a future version.The JPA PessimisticLockScope which corresponds to this Scope.- Returns:
- The corresponding PessimisticLockScope, or
null.
-
fromJpaScope
Deprecated, for removal: This API element is subject to removal in a future version. -
interpret
Deprecated, for removal: This API element is subject to removal in a future version.
-
PessimisticLockScopein JPA 4.