-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Versioning possible with exisiting null timestamp DB column?
PostPosted: Tue Jul 08, 2008 11:42 am 
Newbie

Joined: Wed Jan 10, 2007 9:33 am
Posts: 13
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"/>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.