-->
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: Optimistic locking and timestamps
PostPosted: Wed Oct 14, 2009 8:12 am 
Newbie

Joined: Sun Dec 28, 2008 7:31 am
Posts: 1
I am currently developing an application using Hibernate 3.2 annotations and Oracle 10g. A requirement of the project is that all dates generated in db are derived from a function not from sysdate or systimestamp. Basically the function returns sysdate/systimestamp plus (or minus) x days - where x is a value stored in database. This is supposed to make testing easier ! Unfortunately I have hit a snag when using the @Version annotation for fields mapped to timestamps.

@Column (name="LAST_MODIFIED_TIMESTAMP")
@Temporal(TemporalType.TIMESTAMP)
@Version
public Date getDateLastModified() {
return dateLastModified;
}


If (big assumption) I have understood things correctly Hibernate manages updates to this field as part of its approach to optimistic locking and updates it with reference to sysdate/systimestamp. Is this right ? Is there a way I can influence how Hibernate updates this value - e.g point it to the function ? Or am I forced to introduce an extra versionId field to my model and run my locking from there? Any guidance much appreciated.

Sorry if that all sounds confused but whilst Hibernate is v clever I am not ! Sorry too if this is covered somewhere in the documentation etc - have spent time looking and will continue to do so but with little luck so far.

Thanks


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.