Gene --

There are two interfaces designed to handle this situation: 
org.apache.ojb.broker.PBLifeCycleListener and 
org.apache.ojb.broker.PersistenceBrokerAware.

The PBLifeCycleListener interface can be used by any object.  Just implement the 
interface in your class and register it as a listener with the PersistenceBroker.  
PBLifeCycleListener includes two methods, beforeInsert and beforeUpdate, that are well 
suited for your situation.

The PersistenceBrokerAwareinterface is intended to be used by a persistence-capable 
class.  PersistenceBrokerAwareinterface defines two methods with the same names that 
can also be used in your situation.

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

> From: "Gene Qian" <[EMAIL PROTECTED]>
> Date: 2003/09/18 Thu AM 01:13:59 EDT
> To: [EMAIL PROTECTED]
> Subject: How to Set Last Updated Time Automatically?
> 
> Hi,
> 
> I have a persistent field, say, lastUpdated(column is 
> LAST_UPDATED_DATETIME), which is used to store last updated time of the db 
> record. My question is: Can we use OBJ automatically set and store the field 
> with right datetime when the persistent object was stored to DB with any 
> field value changed? If so, how to do?
> 
> Any comments will be appreciated.
> 
> Gene



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to