db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Dudziak <tom...@gmail.com>
Subject Re: Holy Crap! OJB 1.1 is fast!!
Date Wed, 23 Mar 2005 19:26:47 GMT
> That does bring up the one real question I do have: There was a new
> broker.OJB object that was introduced. All the examples talked about
> doing ojb.lookupBroker() to get a PB instance. We use to do
> PersistenceBrokerFactory.defaultPersistenceBroker(), but I am not sure
> if that is considered the best way anymore. I tried moving to using
> ojb.lookupBroker(), but unless I kept a static reference to the OJB
> object, every time I would create a new broker, it would think that it
> needed to do all the initialization work, and would also give me a fresh
> cache.

That's right, the PersistenceBrokerFactory is for backward
compatibility only. The prefered way of holding onto an instance of
said OJB class is either using ThreadLocal (e.g. for normal
applications; this is what the PersistenceBrokerFactory does) or the
application session (for web applications).
The examples havn't been updated yet (I'm in the process of reworking
the tutorials for the 1.0 branch, and will update them for the CVS
Head too).
> Now as I am typing this, I realize that with the introduction of IOC,
> that my wrapper class should really utilize the Pico container and get
> it's instance of OJB from that.

Yep, that was one of the envisioned uses (esp. when using with
Spring), though to be honest I havn't tried it this way yet :-)


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

View raw message