db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Dudziak <to...@first.fhg.de>
Subject Re: ObjectFactory problem - Pico caching
Date Tue, 16 Nov 2004 14:48:42 GMT
Leandro Rodrigo Saad Cruz wrote:

>I changed my code to :
>
>PBKey key = new PBKey(alias);
>PersistenceBroker broker =
>PersistenceBrokerFactory.createPersistenceBroker(key);
>broker.getConfiguration().getObjectFactory().registerCreator(creator,"*");
>return broker; 
>
>Now it works.. Thanks !
>  
>
I didn't touch the PersistenceBrokerFactory stuff yet, but I will so in 
the next days - which will ultimatively result in the removal of the PBF 
- so perhaps you should migrate to direct usage of the OJB class:

OJB ojb = new OJB();

ojb.getConfiguration().registerCreator(...);
broker = ojb.lookupBroker(key);

Also, the creator registration probably doesn't work the way that you 
think. If you want to register one creator instance that handles *all* 
your classes, you should inherit from the ObjectFactoryDefaultImpl and 
register your instance like this:

OJB ojb = new OJB();

ojb.getComponentContainer().setSingletonInstance(ObjectFactory.class, 
myFactory);
broker = ojb.lookupBroker(key);

but note that you have to do so before the configuration object is 
created (i.e. before using this key).

Btw, the use-factory flag in the class descriptor is no longer 
necessary, I just haven't removed it yet.

Tom


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message