FileDocCategorySizeDatePackage
VersionValue.javaAPI DocHibernate 3.2.53364Sat Jun 04 23:31:34 BST 2005org.hibernate.engine

VersionValue

public class VersionValue extends Object
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

Fields Summary
private static final Log
log
private final Object
value
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.
public static final VersionValue
NEGATIVE
Assume the transient instance is newly instantiated if the version is negative, otherwise assume it is a detached instance.
Constructors Summary
protected VersionValue()

	
	  
		this.value = null;
	
public VersionValue(Object value)
Assume the transient instance is newly instantiated if its version is null or equal to value

param
value value to compare to

		this.value = value;
	
Methods Summary
public java.lang.ObjectgetDefaultValue(java.lang.Object currentValue)

		return value;
	
public java.lang.BooleanisUnsaved(java.lang.Object version)
Does the given version belong to a new instance?

param
version version to check
return
true is unsaved, false is saved, null is undefined

		if ( log.isTraceEnabled() ) log.trace("version unsaved-value: " + value);
		return version==null || version.equals(value) ? Boolean.TRUE : Boolean.FALSE;
	
public java.lang.StringtoString()

		return "version unsaved-value: " + value;