-->
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.  [ 3 posts ] 
Author Message
 Post subject: column formula for update/insert
PostPosted: Wed Feb 02, 2005 4:25 pm 
Newbie

Joined: Mon Jan 31, 2005 1:33 pm
Posts: 11
Hello,

I am currently evaluating Hiberanate for my current project and have a question. My current application has a create and last update date for each of its tables and I would like to use a static formula for the insert and update.

1) DB Triggers - Would like to avoid.
2) Hibernate Interceptors - Would not work because it is vital that the time used is the db time. ie systimestamp.
3) Here is the real question, can this be done on a property or column level? Such that the resulting PreparedStatement looks something like....INSERT INTO FOO (ID, NAME, CR_DATE, LAST_UPD) VALUES (?, ?, systimestamp, systimestamp). I realize that I could use native <sql-insert> but I would like to avoid the overhead of maintaining that.

Regards,
Ryan Lynch


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 02, 2005 6:17 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
what about using timestamp (versionning) for last modification date?

about creation date.... easy to do in java

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 02, 2005 6:39 pm 
Newbie

Joined: Mon Jan 31, 2005 1:33 pm
Posts: 11
>what about using timestamp (versionning) for last modification date?
I will look into that, thanks.

>about creation date.... easy to do in java
Yes, I agree that it is easy but it is important that the value be set to the database time for two reasons
1) Same clock for all values.
2) The actual time of the creation is when it gets inserted by the database not when the object is created or the insert call is made by the client.

Also I would image there are other use cases that may require a value be set using a known db function.

Anthony, thanks for your response.


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

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.