Re: how to clear cache

"Alessandro Colantoni" <[email protected]> Tue, 25 Sep 2007 19:15:41 +0200
Newsgroups gmane.comp.jakarta.ojb.user
Message-ID <[email protected]>
Hi,
When you use OjbPbDAO of Mandragora, in each method it does (through the
ServiceLocator)
PersistenceBroker broker broker=
PersistenceBrokerFactory.defaultPersistenceBroker();

than at the end of the method it does

broker.close();

I understand that each time it is used a different PB.

I think it is right. For each transaction I get a broker use it and then
close.
That's the way my OjbPbDAO  works.

Anyway remember that Mandragora works with the interface DAO, and if you
think in a  better way can be done,
we could write an other DAO implementation, and it is used just changing the
correspondent entry in Mandragora.properties

Regards

Alessandro

On 9/25/07, Hans Novak <[email protected]> wrote:
>
>
>
> >
> > PersistenceBroker.clearCache();
> > to evict the whole cache
>
> yes, this works, but will increase the database access a lot.
> You speaks about the possibility, that ojb and mandragora can use the
> same PB ... how ?
> I have a dao class, with the broker.
> This broker is private and will not used in any other classes !?
>
> The other way is to clear only the obj with a oid - but what for oid ?
> (a uniqe id from a filed in database ?)
> But this operation willincrase the access to the db too....
> The better way is to use the same broker, i think.
>
> Hans
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>