-->
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: Update timestamp column with current database server time
PostPosted: Tue May 17, 2005 1:57 pm 
Newbie

Joined: Fri Apr 01, 2005 6:47 pm
Posts: 11
I've seen this question asked a few times but haven't seen an answer. I would like to update certain timestamp columns with the database server's current date/time. For Oracle and MySQL you would use sysdate. But I don't see a way to do this using Hibernate. If I do a myobject.setLastDate(currenttime) I must send a Java timestamp value. I need a way to tell Hibernate to add "sysdate" to the SQL rather than a hard-coded timestamp value.

I could setup a trigger in the database and set the Hibernate mapping so update="false" and insert="false", but it seems there should be a way to handle this in Hibernate. And it is bad practice to use the application server's current time since you may have multiple application server's accessing the same database, and their clocks may be slightly different.

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.