OJB 1.0.3 Caching issues

2005-12-01 Thread Ravi
Hello !


We are using OJB 1.0.3 with following cache settings on Oracle database.

   object-cache 
class=org.apache.ojb.broker.cache.ObjectCacheDefaultImpl
attribute attribute-name=cacheExcludes attribute-value=/
attribute attribute-name=timeout attribute-value=900/
attribute attribute-name=autoSync attribute-value=false/
attribute attribute-name=cachingKeyType attribute-value=0/
attribute attribute-name=useSoftReferences attribute-value=true/
  /object-cache

Once in a while the cache goes out of sync with the database and objects 
looses references to other objects and application breaks. The objects in 
question reference to each other with auto-update=true in reference-
descriptor on both object mappings.


Can you please let us know what's going wrong with Object caching and anything 
wrong with above setting?

Many Thanks in Advance

Regards

Ravi




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



Re: OJB 1.0.3 Caching issues

2005-12-01 Thread Danilo Tommasina

Hi,

I am not sure if it is the same problem, however we had something similar some 
time ago.
The problem was caused by the cache timeout.

Imagine this situation:

CustomObject1 (not a persistent object) has a reference to an instance of ex. 
PersistentObject.class with primary key = 1, let us call it PersistentObject1

Now when you initialise CustomObject1 it will load the reference to PersistentObject1 and store it in a local property. This will cause PersistenObject1 to be 
loaded from database and put into OJB cache.

When a timeout on PersistenObject1 occurs it will be removed from OJB cache, 
however CustomObject1 will still have an active reference to it.

Now another operation causes OJB to load a new instance of PersistentObject.class again with PK = 1 to be loaded from database. Since PersistentObject1 is no 
longer in the OJB cache, a new instance will be created, let us call it PersistentObject2.


At this point if changes are done on PersistentObject1 they will not be reflected on PersistentObject2 and changes on PersistentObject2 will not be reflected on 
PersistentObject1.


If you set the timeout to -1 no timeout will occur, the cache will be cleaned (soft-references) by the garbage collector when a cached object is no longer 
referenced by any other active object.


bye
Danilo


Hello !


We are using OJB 1.0.3 with following cache settings on Oracle database.

   object-cache 
class=org.apache.ojb.broker.cache.ObjectCacheDefaultImpl

attribute attribute-name=cacheExcludes attribute-value=/
attribute attribute-name=timeout attribute-value=900/
attribute attribute-name=autoSync attribute-value=false/
attribute attribute-name=cachingKeyType attribute-value=0/
attribute attribute-name=useSoftReferences attribute-value=true/
  /object-cache

Once in a while the cache goes out of sync with the database and objects 
looses references to other objects and application breaks. The objects in 
question reference to each other with auto-update=true in reference-

descriptor on both object mappings.


Can you please let us know what's going wrong with Object caching and anything 
wrong with above setting?


Many Thanks in Advance

Regards

Ravi




-
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]