public final class Versioning extends Object
Modifier and Type | Method and Description |
---|---|
static Object |
getVersion(Object[] fields,
EntityPersister persister)
Extract the optimistic locking value out of the entity state snapshot.
|
static Object |
increment(Object version,
VersionType versionType,
SessionImplementor session)
Generate the next increment in the optimistic locking value according
the
VersionType contract for the version property. |
static boolean |
isVersionIncrementRequired(int[] dirtyProperties,
boolean hasDirtyCollections,
boolean[] propertyVersionability)
Do we need to increment the version number, given the dirty properties?
|
static boolean |
seedVersion(Object[] fields,
int versionProperty,
VersionType versionType,
SessionImplementor session)
Create an initial optimistic locking value according the
VersionType
contract for the version property if required and inject it into
the snapshot state. |
static void |
setVersion(Object[] fields,
Object version,
EntityPersister persister)
Inject the optimistic locking value into the entity state snapshot.
|
public static boolean seedVersion(Object[] fields, int versionProperty, VersionType versionType, SessionImplementor session)
VersionType
contract 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 sessionpublic static Object increment(Object version, VersionType versionType, SessionImplementor session)
VersionType
contract for the version property.version
- The current versionversionType
- The version typesession
- The originating sessionpublic static void setVersion(Object[] fields, Object version, EntityPersister persister)
fields
- The state snapshotversion
- The optimistic locking valuepersister
- The entity persisterpublic static Object getVersion(Object[] fields, EntityPersister persister)
fields
- The state snapshotpersister
- The entity persisterpublic static boolean isVersionIncrementRequired(int[] dirtyProperties, boolean hasDirtyCollections, boolean[] propertyVersionability)
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.Copyright © 2001-2017 Red Hat, Inc. All Rights Reserved.