Hi,

I've never used OJB in managed environment, but looking at the
PersistenBrokerFactorySyncImpl
(http://cvs.apache.org/viewcvs.cgi/db-ojb/src/java/org/apache/ojb/broker/cor
e/PersistenceBrokerFactorySyncImpl.java?view=markup)
specifically, the PersistenceBrokerSyncImpl inner class, it certainly seems
to implement to the Synchronsation and pass on the calls to the delegating
PB - which would intern invoke the listeners.

However, the tricky bit would be where to add the listeners - as you'd have
to subclass the PersistenceBrokerFactorySyncImpl broker factory. Armin seems
to be the man to do with using PB in a managed environment; I'll have to
leave you in his hands for where to add the listeners.

Charles.

-----Original Message-----
From: Vesely, Max [IT] [mailto:[EMAIL PROTECTED]
Sent: 07 April 2005 14:25
To: OJB Users List
Subject: RE: OJB Listener :: Best practise


Charles,

Do you know if listener state events (afterBegin, afterCommit, ...)  are
going to be invoked in managed environment?

Thank you,
Max.

-----Original Message-----
From: Charles Anthony [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 07, 2005 9:12 AM
To: 'OJB Users List'
Cc: [EMAIL PROTECTED]
Subject: RE: OJB Listener :: Best practise



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]


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



___________________________________________________________
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