You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Joose Vettenranta <jo...@iki.fi> on 2004/08/03 14:56:36 UTC

persistence broker and cache and different connection

Hi,

I have my software running as 2 instance.. using connection-descriptor 
A and B

both A and B uses same classes.

problem:

if I create something on A it is cached - good, ok
if I create something on B it is cached - good, ok

but problem is that A and B's cache is the same. So if I look at bean 
with connection B and it is previously viewed by connection A, then A's 
value is shown, always..

So, how can I make that cache persistent to connections? So that when I 
do like:

dao.retrieve(bean(3), fromTableA) != dao.retrieve (bean(3), fromTableB);

both ones are the same, even though the database is different.

Using persistentbroker and ojb 1.0.rc6

Thanks,

Joose

--
"Always remember that you are unique, just like everyone else!"
* http://iki.fi/joose/ * joose@iki.fi * +358 44 561 0270 *


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


Re: persistence broker and cache and different connection

Posted by Joose Vettenranta <jo...@iki.fi>.
Seems like I got it to work.

Changed from OJB.properties to cache per Broker.

- Joose

3.8.2004 kello 15:56, Joose Vettenranta kirjoitti:

  Hi,
>
> I have my software running as 2 instance.. using connection-descriptor 
> A and B
>
> both A and B uses same classes.
>
> problem:
>
> if I create something on A it is cached - good, ok
> if I create something on B it is cached - good, ok
>
> but problem is that A and B's cache is the same. So if I look at bean 
> with connection B and it is previously viewed by connection A, then 
> A's value is shown, always..
>
> So, how can I make that cache persistent to connections? So that when 
> I do like:
>
> dao.retrieve(bean(3), fromTableA) != dao.retrieve (bean(3), 
> fromTableB);
>
> both ones are the same, even though the database is different.
>
> Using persistentbroker and ojb 1.0.rc6
>
> Thanks,
>
> Joose
>
> --
> "Always remember that you are unique, just like everyone else!"
> * http://iki.fi/joose/ * joose@iki.fi * +358 44 561 0270 *
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
--
"Always remember that you are unique, just like everyone else!"
* http://iki.fi/joose/ * joose@iki.fi * +358 44 561 0270 *


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


Re: persistence broker and cache and different connection

Posted by Armin Waibel <ar...@apache.org>.
Hi Joose,

current cache implementations don't take care of this. This will be
supported in OJB 1.1. As workaround you could implement your on
ObjectCache implementation (I modified ObjectCacheDefaultImpl to support 
your requirement, see below) or only use ObjectCachePerBrokerImpl (which
always clear the cache after PB.close or PB.abortTx).

Checked in a new version of ObjectCacheDefaultImpl which supports now a
new flag allows to determine how the key for the cached objects will be
build. Now it should be possible to use the default cache for the same 
metadata model with different connection-descriptor.

Revision 1.25
http://cvs.apache.org/viewcvs.cgi/db-ojb/src/java/org/apache/ojb/broker/cache/ObjectCacheDefaultImpl.java

I don't setup a test case, so no guarantee ... ;-)

regards,
Armin



Joose Vettenranta wrote:

> Hi,
> 
> I have my software running as 2 instance.. using connection-descriptor A 
> and B
> 
> both A and B uses same classes.
> 
> problem:
> 
> if I create something on A it is cached - good, ok
> if I create something on B it is cached - good, ok
> 
> but problem is that A and B's cache is the same. So if I look at bean 
> with connection B and it is previously viewed by connection A, then A's 
> value is shown, always..
> 
> So, how can I make that cache persistent to connections? So that when I 
> do like:
> 
> dao.retrieve(bean(3), fromTableA) != dao.retrieve (bean(3), fromTableB);
> 
> both ones are the same, even though the database is different.
> 
> Using persistentbroker and ojb 1.0.rc6
> 
> Thanks,
> 
> Joose
> 
> -- 
> "Always remember that you are unique, just like everyone else!"
> * http://iki.fi/joose/ * joose@iki.fi * +358 44 561 0270 *
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 
> 



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