Here's a quick off the cuff list of steps for listeners that work for both
ODMG & PB, based on what we do here.

a) Create your own persistence broker factory, extending
PersistenceBrokerFactoryDefaultImpl

b) Override createNewBrokerInstance(PBKey key) and add your listener(s)
http://db.apache.org/ojb/api/org/apache/ojb/broker/core/PersistenceBrokerFac
toryDefaultImpl.html#createPersistenceBroker
e.g. (One listener instance for all brokers )
    protected PersistenceBroker createNewBrokerInstance(PBKey key) throws
PBFactoryException {
       PersistenceBroker newBrokerInstance =
super.createNewBrokerInstance(key);
       newBrokerInstance.addListener(yourListenerInstance)    
    return newBrokerInstance;
  }

c) Change PersistenceBrokerFactoryClass entry in OJB.properties to point to
your new class

e.g. 
##PersistenceBrokerFactoryClass=org.apache.ojb.broker.core.PersistenceBroker
FactoryDefaultImpl
PersistenceBrokerFactoryClass=com.mycompany.MyBrokerFactory

d) There is no d)

Cheers,

Charles.


-----Original Message-----
From: Nils Liebelt [mailto:[EMAIL PROTECTED]
Sent: 07 April 2005 13:55
To: 'OJB Users List'
Cc: [EMAIL PROTECTED]
Subject: OJB Listener :: Best practise


Hi everybody,

 

I need a simple Listener which methods get called after insert, update and
delete. I just found Listener for Transaction stuff in the API. Any
suggestions?

 

 

GreetZ

 

Nils



___________________________________________________________
HPD Software Ltd. - Helping Business Finance Business
Email terms and conditions: www.hpdsoftware.com/disclaimer 



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

Reply via email to