-->
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: Hibernate trigger equivalent?
PostPosted: Wed Apr 20, 2005 8:29 am 
Regular
Regular

Joined: Sun Nov 07, 2004 3:39 pm
Posts: 77
I'm sure this is straightforward but can't find the answer. I have a whole bunch of business objects (POJOs) all descended from a base BusinessObject class. I would like a method in this class to be run every time an object is about to be persisted to the database. Can this be done?

The method is just a timestamping one (setting created and last modified dates), and there may be another way of doing this which I would be keen to hear of.

TIA.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 20, 2005 8:39 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Take a look at Interceptor and Lifecycle


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 20, 2005 8:54 am 
Regular
Regular

Joined: Sun Nov 07, 2004 3:39 pm
Posts: 77
Yes, that's definitely the answer, thanks. I'm using Spring with Hibernate, and have a service layer managed by Spring. If you are familiar with Spring, how would I use this Interceptor in a Spring context? Would I subclass it and add it as one of the interceptors configured for org.springframework.transaction.interceptor.TransactionProxyFactoryBean, say? (Sorry if this is more of a Spring question than a Hibernate one).


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.