Is it possible to specify an existing DB timestamp column that contains null values as a versioning field?
I have the common case of having a creation date timestamp field that is populated on a row insert, and a last update date field that is set to null during the Initial insert. Last update date is updated during update operations only. I want to implement concurrency control based on the last update date, but it appears that this column needs to be populated with an initial value in order to be used for the version field.
I have posted my attempts at including a version tag in the table's mapping file below. I receive this exception message for all of my variations:
Code:
Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)
Also, this post explains a similar problem, but I cannot use view in the way that this person has described:
[url]http://forum.hibernate.org/viewtopic.php?t=969598&highlight=versioning+null+timestamp
[/url]
Thanks.
Hibernate version:
3.2
Mapping documents:
<version name="lastUpdateDate"
column="LAST_UPDATE_DATE"
type="timestamp"
unsaved-value="null"/>
I also tried these variations:
<version name="lastUpdateDate"
column="LAST_UPDATE_DATE"
type="timestamp"/>
<version name="lastUpdateDate"
column="LAST_UPDATE_DATE"
type="timestamp"
unsaved-value="undefined"/>