Top Description Fields Constructors Methods
org.hibernate.engine

public Class VersionValue

extends Object
Class Inheritance
Imports
org.slf4j.Logger, .LoggerFactory, org.hibernate.MappingException, org.hibernate.id.IdentifierGeneratorHelper

A strategy for determining if a version value is an version of a new transient instance or a previously persistent transient instance. The strategy is determined by the unsaved-value attribute in the mapping file.
Author
Gavin King

Field Summary

Modifier and TypeField and Description
private static final Logger
public static final VersionValue
NEGATIVE

Assume the transient instance is newly instantiated if the version is negative, otherwise assume it is a detached instance.

public static final VersionValue
NULL

Assume the transient instance is newly instantiated if the version is null, otherwise assume it is a detached instance.

public static final VersionValue
UNDEFINED

Assume the transient instance is newly instantiated if the version is null, otherwise defer to the identifier unsaved-value.

private final Object

Constructor Summary

AccessConstructor and Description
protected
public
VersionValue(Object
value to compare to
value
)

Assume the transient instance is newly instantiated if its version is null or equal to value

Method Summary

Modifier and TypeMethod and Description
public Object
getDefaultValue(Object currentValue)

public Boolean

Returns:

true is unsaved, false is saved, null is undefined
isUnsaved
(Object
version to check
version
)

Does the given version belong to a new instance?

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

logback to summary
private static final Logger log
NEGATIVEback to summary
public static final VersionValue NEGATIVE

Assume the transient instance is newly instantiated if the version is negative, otherwise assume it is a detached instance.

NULLback to summary
public static final VersionValue NULL

Assume the transient instance is newly instantiated if the version is null, otherwise assume it is a detached instance.

UNDEFINEDback to summary
public static final VersionValue UNDEFINED

Assume the transient instance is newly instantiated if the version is null, otherwise defer to the identifier unsaved-value.

valueback to summary
private final Object value

Constructor Detail

VersionValueback to summary
protected VersionValue()
VersionValueback to summary
public VersionValue(Object value)

Assume the transient instance is newly instantiated if its version is null or equal to value

Parameters
value:Object

value to compare to

Method Detail

getDefaultValueback to summary
public Object getDefaultValue(Object currentValue)
isUnsavedback to summary
public Boolean isUnsaved(Object version) throws MappingException

Does the given version belong to a new instance?

Parameters
version:Object

version to check

Returns:Boolean

true is unsaved, false is saved, null is undefined

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.