org.hibernate.engine
Class Versioning

java.lang.Object
  extended byorg.hibernate.engine.Versioning

public final class Versioning
extends Object

Utility methods for managing versions and timestamps

Author:
Gavin King

Field Summary
static int OPTIMISTIC_LOCK_ALL
           
static int OPTIMISTIC_LOCK_DIRTY
           
static int OPTIMISTIC_LOCK_NONE
           
static int OPTIMISTIC_LOCK_VERSION
           
 
Method Summary
static Object getVersion(Object[] fields, EntityPersister persister)
          Get the version number of the given instance state snapshot
static Object increment(Object version, VersionType versionType, SessionImplementor session)
          Increment the given version number
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)
          Seed the given instance state snapshot with an initial version number
static void setVersion(Object[] fields, Object version, EntityPersister persister)
          Set the version number of the given instance state snapshot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPTIMISTIC_LOCK_NONE

public static final int OPTIMISTIC_LOCK_NONE
See Also:
Constant Field Values

OPTIMISTIC_LOCK_ALL

public static final int OPTIMISTIC_LOCK_ALL
See Also:
Constant Field Values

OPTIMISTIC_LOCK_DIRTY

public static final int OPTIMISTIC_LOCK_DIRTY
See Also:
Constant Field Values

OPTIMISTIC_LOCK_VERSION

public static final int OPTIMISTIC_LOCK_VERSION
See Also:
Constant Field Values
Method Detail

increment

public static Object increment(Object version,
                               VersionType versionType,
                               SessionImplementor session)
Increment the given version number


seedVersion

public static boolean seedVersion(Object[] fields,
                                  int versionProperty,
                                  VersionType versionType,
                                  SessionImplementor session)
Seed the given instance state snapshot with an initial version number


setVersion

public static void setVersion(Object[] fields,
                              Object version,
                              EntityPersister persister)
Set the version number of the given instance state snapshot


getVersion

public static Object getVersion(Object[] fields,
                                EntityPersister persister)
                         throws HibernateException
Get the version number of the given instance state snapshot

Throws:
HibernateException

isVersionIncrementRequired

public static boolean isVersionIncrementRequired(int[] dirtyProperties,
                                                 boolean hasDirtyCollections,
                                                 boolean[] propertyVersionability)
Do we need to increment the version number, given the dirty properties?