Package org.hibernate.engine.spi
Class VersionValue
java.lang.Object
org.hibernate.engine.spi.VersionValue
- All Implemented Interfaces:
UnsavedValueStrategy
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.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final VersionValue
Assume the transient instance is newly instantiated if the version is negative, otherwise assume it is a detached instance.static final VersionValue
Assume the transient instance is newly instantiated if the version is null, otherwise assume it is a detached instance.static final VersionValue
Assume the transient instance is newly instantiated if the version is null, otherwise defer to the identifier unsaved-value. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
VersionValue
(Object value) Assume the transient instance is newly instantiated if its version is null or equal tovalue
-
Method Summary
-
Field Details
-
NULL
Assume the transient instance is newly instantiated if the version is null, otherwise assume it is a detached instance. -
UNDEFINED
Assume the transient instance is newly instantiated if the version is null, otherwise defer to the identifier unsaved-value. -
NEGATIVE
Assume the transient instance is newly instantiated if the version is negative, otherwise assume it is a detached instance.
-
-
Constructor Details
-
VersionValue
protected VersionValue() -
VersionValue
Assume the transient instance is newly instantiated if its version is null or equal tovalue
- Parameters:
value
- value to compare to
-
-
Method Details
-
isUnsaved
Description copied from interface:UnsavedValueStrategy
Make the transient/detached determination- Specified by:
isUnsaved
in interfaceUnsavedValueStrategy
- Parameters:
version
- The value to be tested- Returns:
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.- Throws:
MappingException
-
getDefaultValue
Description copied from interface:UnsavedValueStrategy
Get a default value meant to indicate transience.- Specified by:
getDefaultValue
in interfaceUnsavedValueStrategy
- Parameters:
currentValue
- The current state value.- Returns:
- The default transience value.
-
toString
-