类 Versioning
- java.lang.Object
-
- org.hibernate.engine.internal.Versioning
-
public final class Versioning extends Object
Utilities for dealing with optimistic locking values.- 作者:
- Gavin King
-
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static ObjectgetVersion(Object[] fields, EntityPersister persister)Extract the optimistic locking value out of the entity state snapshot.static Objectincrement(Object version, VersionType versionType, SharedSessionContractImplementor session)Generate the next increment in the optimistic locking value according theVersionTypecontract for the version property.static booleanisVersionIncrementRequired(int[] dirtyProperties, boolean hasDirtyCollections, boolean[] propertyVersionability)Do we need to increment the version number, given the dirty properties?static booleanseedVersion(Object[] fields, int versionProperty, VersionType versionType, SharedSessionContractImplementor session)Create an initial optimistic locking value according theVersionTypecontract for the version property if required and inject it into the snapshot state.static voidsetVersion(Object[] fields, Object version, EntityPersister persister)Inject the optimistic locking value into the entity state snapshot.
-
-
-
方法详细资料
-
seedVersion
public static boolean seedVersion(Object[] fields, int versionProperty, VersionType versionType, SharedSessionContractImplementor session)
Create an initial optimistic locking value according theVersionTypecontract for the version property if required and inject it into the snapshot state.- 参数:
fields- The current snapshot stateversionProperty- The index of the version propertyversionType- The version typesession- The originating session- 返回:
- True if we injected a new version value into the fields array; false otherwise.
-
increment
public static Object increment(Object version, VersionType versionType, SharedSessionContractImplementor session)
Generate the next increment in the optimistic locking value according theVersionTypecontract for the version property.- 参数:
version- The current versionversionType- The version typesession- The originating session- 返回:
- The incremented optimistic locking value.
-
setVersion
public static void setVersion(Object[] fields, Object version, EntityPersister persister)
Inject the optimistic locking value into the entity state snapshot.- 参数:
fields- The state snapshotversion- The optimistic locking valuepersister- The entity persister
-
getVersion
public static Object getVersion(Object[] fields, EntityPersister persister)
Extract the optimistic locking value out of the entity state snapshot.- 参数:
fields- The state snapshotpersister- The entity persister- 返回:
- The extracted optimistic locking value
-
isVersionIncrementRequired
public static boolean isVersionIncrementRequired(int[] dirtyProperties, boolean hasDirtyCollections, boolean[] propertyVersionability)Do we need to increment the version number, given the dirty properties?- 参数:
dirtyProperties- The array of property indexes which were deemed dirtyhasDirtyCollections- Were any collections found to be dirty (structurally changed)propertyVersionability- An array indicating versionability of each property.- 返回:
- True if a version increment is required; false otherwise.
-
-