Hello,
I am using versioning for optimistic locking. Let's say I'm using:
Code:
<version name="tstamp" type="long" unsaved-value="undefined"/>
I stress the undefined part, since I read in the docs:
"(undefined specifies that the identifier property value should be used.)".
From this, I understand (and my apologies if my understanding is incorrect) that, by using undefined, I do not want to use the versioning property to determine if a data object is unsaved, but instead wish to defer to the identifier property.
Now, in the code for net.sf.hibernate.engine.Cascades, line 390 (2.1.7c), I see the following:
Code:
/**
* Assume the transient instance is newly instantiated if the version
* is null, otherwise defer to the identifier unsaved-value.
*/
public static final VersionValue VERSION_UNDEFINED = new VersionValue() {
public final Boolean isUnsaved(Object version) {
log.trace("version unsaved-value strategy UNDEFINED");
return version==null ? Boolean.TRUE : null;
}
};
I wonder if this is indeed correct, as I think the implementation might contradict the documentation. Might not this be the correct implementation?
Code:
/**
* Defer to the identifier unsaved-value.
*/
public static final VersionValue VERSION_UNDEFINED = new VersionValue() {
public final Boolean isUnsaved(Object version) {
log.trace("version unsaved-value strategy UNDEFINED");
return null;
}
};
Please tell me if my interpretation of what's going on is correct or if I am being silly through the fact that I would really like my interpretation to be correct :)
Thanks a lot!
Alfonso.