Package org.hibernate.engine.spi
Class IdentifierValue
java.lang.Object
org.hibernate.engine.spi.IdentifierValue
- All Implemented Interfaces:
UnsavedValueStrategy
A strategy for determining if an identifier value is an identifier 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 IdentifierValueAlways assume the transient instance is newly instantiatedstatic final IdentifierValueNever assume the transient instance is newly instantiatedstatic final IdentifierValueAssume the transient instance is newly instantiated if the identifier is null.static final IdentifierValueAssume nothing. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedIdentifierValue(Object value) Assume the transient instance is newly instantiated if its identifier is null or equal tovalue -
Method Summary
-
Field Details
-
ANY
Always assume the transient instance is newly instantiated -
NONE
Never assume the transient instance is newly instantiated -
NULL
Assume the transient instance is newly instantiated if the identifier is null. -
UNDEFINED
Assume nothing.
-
-
Constructor Details
-
IdentifierValue
protected IdentifierValue() -
IdentifierValue
Assume the transient instance is newly instantiated if its identifier is null or equal tovalue
-
-
Method Details
-
isUnsaved
Does the given identifier belong to a new instance?- Specified by:
isUnsavedin interfaceUnsavedValueStrategy- Parameters:
id- The value to be tested- Returns:
trueindicates the value corresponds to unsaved data (aka, transient state);falseindicates the value does not corresponds to unsaved data (aka, detached state);nullindicates that this strategy was not able to determine conclusively.
-
getDefaultValue
Description copied from interface:UnsavedValueStrategyGet a default value meant to indicate transience.- Specified by:
getDefaultValuein interfaceUnsavedValueStrategy- Parameters:
currentValue- The current state value.- Returns:
- The default transience value.
-
toString
-