Top Description Fields Constructors Methods
org.hibernate.engine.spi

public Class VersionValue

extends Object
implements UnsavedValueStrategy
Class Inheritance
All Implemented Interfaces
org.hibernate.engine.spi.UnsavedValueStrategy
Imports
org.hibernate.MappingException, org.hibernate.id.IdentifierGeneratorHelper, org.hibernate.internal.CoreLogging, org.jboss.logging.Logger

A strategy for determining if a version value is a 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
The current state value.
currentValue
)

Implements org.hibernate.engine.spi.UnsavedValueStrategy.getDefaultValue.

Get a default value meant to indicate transience.
public Boolean
isUnsaved(Object
The value to be tested
version
)

Implements org.hibernate.engine.spi.UnsavedValueStrategy.isUnsaved.

Make the transient/detached determination
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)

Implements org.hibernate.engine.spi.UnsavedValueStrategy.getDefaultValue.

Doc from org.hibernate.engine.spi.UnsavedValueStrategy.getDefaultValue.

Get a default value meant to indicate transience.

Parameters
currentValue:Object

The current state value.

Returns:Object

The default transience value.

Annotations
@Override
isUnsavedback to summary
public Boolean isUnsaved(Object version) throws MappingException

Implements org.hibernate.engine.spi.UnsavedValueStrategy.isUnsaved.

Doc from org.hibernate.engine.spi.UnsavedValueStrategy.isUnsaved.

Make the transient/detached determination

Parameters
version:Object

The value to be tested

Returns:Boolean

true indicates the value corresponds to unsaved data (aka, transient state); false indicates the value does not corresponds to unsaved data (aka, detached state); null indicates that this strategy was not able to determine conclusively.

Annotations
@Override
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.

Annotations
@Override