org.hibernate.type
Interface VersionType<T>

All Superinterfaces:
Serializable, Type
All Known Implementing Classes:
AbstractBynaryType, AbstractLongBinaryType, BinaryType, ByteType, CalendarType, CustomType, DbTimestampType, IntegerType, LongType, ShortType, TimestampType

public interface VersionType<T>
extends Type

Additional contract for types which may be used to version (and optimistic lock) data.

Author:
Gavin King, Steve Ebersole

Method Summary
 Comparator<T> getComparator()
          Get a comparator for version values.
 boolean isEqual(T x, T y)
          Are the two version values considered equal?
 T next(T current, SessionImplementor session)
          Increment the version.
 T seed(SessionImplementor session)
          Generate an initial version.
 
Methods inherited from interface org.hibernate.type.Type
assemble, beforeAssemble, compare, deepCopy, disassemble, fromXMLNode, getColumnSpan, getHashCode, getHashCode, getName, getReturnedClass, getSemiResolvedType, hydrate, isAnyType, isAssociationType, isCollectionType, isComponentType, isDirty, isDirty, isEntityType, isEqual, isEqual, isModified, isMutable, isSame, isXMLElement, nullSafeGet, nullSafeGet, nullSafeSet, nullSafeSet, replace, replace, resolve, semiResolve, setToXMLNode, sqlTypes, toColumnNullness, toLoggableString
 

Method Detail

seed

T seed(SessionImplementor session)
Generate an initial version.

Parameters:
session - The session from which this request originates.
Returns:
an instance of the type

next

T next(T current,
       SessionImplementor session)
Increment the version.

Parameters:
session - The session from which this request originates.
current - the current version
Returns:
an instance of the type

getComparator

Comparator<T> getComparator()
Get a comparator for version values.

Returns:
The comparator to use to compare different version values.

isEqual

boolean isEqual(T x,
                T y)
Are the two version values considered equal?

Parameters:
x - One value to check.
y - The other value to check.
Returns:
true if the values are equal, false otherwise.


Copyright © 2001-2010 Red Hat, Inc. All Rights Reserved.