-->
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.  [ 2 posts ] 
Author Message
 Post subject: Hibernate fill data field in db automatically - how do that?
PostPosted: Thu Aug 24, 2006 7:13 am 
Newbie

Joined: Thu Aug 24, 2006 5:41 am
Posts: 2
Hi,

first of all - sorry for my 'broken' english :-).


Now,

I have some table in my db, and there is date column called inserting_date. When new record will be added then current date should also be added to this coulm.

So I don't want do this in the Java way (insertingDate = new Date(); and then insert) but I like want to hibernate do it same (like autoincrementing in id coulm).

Is this possible?


Thanks,
pss.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 24, 2006 8:52 am 
Newbie

Joined: Thu May 04, 2006 5:04 am
Posts: 17
Location: Austria
You can use the Interceptor concept from Hibernate to inspect and modify properties of entities at certain points in their lifecycle (eg. read, update...).

More information is available at:
JavaDoc: http://www.hibernate.org/hib_docs/v3/api/org/hibernate/Interceptor.html
Reference: http://www.hibernate.org/hib_docs/v3/reference/en/html/events.html

kind regards, Chris

_________________
Please don't forget to rate the posting if it helped you, thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.