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 Jair da Silva Ferreira Júnior <j2...@amazon.com.br> on 2003/12/30 23:14:33 UTC
cache implementation change in rc5?
Hi,
I am using ojb1.0_rc5, ODMG api with OJB queries, mysql4 (innodb tables) in Linux Red Hat 7.3 (kernel 2.4.20-20.7).
I moved from rc4 to rc5 recently and I noticed that sometimes when I run a query the resulting associated objects don't come from the cache. Please, take a look at the above code to better undestand what I am saying:
Transaction t=implementation.newTransaction();
t.begin();
Person p=new Person();
t.lock(p,t.WRITE);
p.setName("somebody");
Dog d=new Dog();
t.lock(d,t.WRITE);
d.setName("Spike");
p.setDog(d);
t.commit();
t=implementation.newTransaction();
t.begin();
Criteria crit=new Criteria();
crit.addEqualTo("_id",new Integer(p.getId()));
QueryByCriteria query=QueryFactory.newQuery(Person.class,crit);
PersistenceBroker broker=((HasBroker)t).getBroker();
broker.removeFromCache(p);
Person loaded=(Person)broker.getObjectByQuery(query);
boolean cacheOk=(loaded.getDog()==d); //here cacheOk==false sometimes
t.commit();
The atributes (proxy, refresh, auto-retrieve, auto-update and auto-delete) in the reference-descriptor for the association between Person and Dog have default values. This way, refresh="false".
This problem does not happen everytime. So, sometimes cacheOk==true.
I wasn't able to reproduce this problem in a test case, but it does happen sometimes.
I've used rc4 for a long time and I've never had this kind of problem.
Here's my cache configuration in OJB.properties:
ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCacheDefaultImpl
descriptorBasedCaches=false
Thanks,
Jair Jr
Re: cache implementation change in rc5?
Posted by Jair da Silva Ferreira Júnior <j2...@amazon.com.br>.
Hi Armin,
> Hi Jair jr,
>
> Jair da Silva Ferreira Júnior wrote:
> > Hi Armin,
> > Thank you very much for your fast reply.
> >
> >
> >>it's a(/my) bug in ObjectCacheDefaultImpl (rc5) causing this strange
> >>behaviour. I will check in a fixed version tomorrow.
> >
> >
> > Ok. How can I get the fixed ObjectCacheDefaultImpl implementation?
Only
> > through CVS?
>
> Yes, it's in CVS head. Release date of final 1.0 is 04 Jan (+-?days) and
> it will contain all fixes.
>
> > Are you going to deploy a new rc5 binary version with this fix?
> >
> If you interested in a binary CVS snapshoot I can send you one.
Thanks, but as my project is on schedule I think I can wait for the
final 1.0 OJB version which, as you said, will be available in 1 or 2 days.
Thanks for your help,
Jair Jr
>
> regards,
> Armin
>
>
> > Thanks,
> > Jair Jr
> >
> >
> >>Jair da Silva Ferreira Júnior wrote:
> >>
> >>>Hi,
> >>> I am using ojb1.0_rc5, ODMG api with OJB queries, mysql4 (innodb
> >
> > tables) in Linux Red Hat 7.3 (kernel 2.4.20-20.7).
> >
> >>> I moved from rc4 to rc5 recently and I noticed that sometimes when
I
> >
> > run a query the resulting associated objects don't come from the cache.
> > Please, take a look at the above code to better undestand what I am
saying:
> >
> >>> Transaction t=implementation.newTransaction();
> >>> t.begin();
> >>> Person p=new Person();
> >>> t.lock(p,t.WRITE);
> >>> p.setName("somebody");
> >>> Dog d=new Dog();
> >>> t.lock(d,t.WRITE);
> >>> d.setName("Spike");
> >>> p.setDog(d);
> >>> t.commit();
> >>>
> >>> t=implementation.newTransaction();
> >>> t.begin();
> >>> Criteria crit=new Criteria();
> >>> crit.addEqualTo("_id",new Integer(p.getId()));
> >>> QueryByCriteria query=QueryFactory.newQuery(Person.class,crit);
> >>> PersistenceBroker broker=((HasBroker)t).getBroker();
> >>> broker.removeFromCache(p);
> >>> Person loaded=(Person)broker.getObjectByQuery(query);
> >>> boolean cacheOk=(loaded.getDog()==d); //here cacheOk==false
sometimes
> >>> t.commit();
> >>>
> >>> The atributes (proxy, refresh, auto-retrieve, auto-update and
> >
> > auto-delete) in the reference-descriptor for the association between
Person
> > and Dog have default values. This way, refresh="false".
> >
> >>> This problem does not happen everytime. So, sometimes
cacheOk==true.
> >>> I wasn't able to reproduce this problem in a test case, but it does
> >
> > happen sometimes.
> >
> >>> I've used rc4 for a long time and I've never had this kind of
> >
> > problem.
> >
> >>> Here's my cache configuration in OJB.properties:
> >>>
> >>>
> >
> > ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCacheDefaultImpl
> >
> >>> descriptorBasedCaches=false
> >>>
> >>>Thanks,
> >>> Jair Jr
> >>
> >>
> >>
> >>---------------------------------------------------------------------
> >>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
> >
> >
> >
>
>
>
>
>
> ---------------------------------------------------------------------
> 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
Re: cache implementation change in rc5?
Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi Jair jr,
Jair da Silva Ferreira Júnior wrote:
> Hi Armin,
> Thank you very much for your fast reply.
>
>
>>it's a(/my) bug in ObjectCacheDefaultImpl (rc5) causing this strange
>>behaviour. I will check in a fixed version tomorrow.
>
>
> Ok. How can I get the fixed ObjectCacheDefaultImpl implementation? Only
> through CVS?
Yes, it's in CVS head. Release date of final 1.0 is 04 Jan (+-?days) and
it will contain all fixes.
> Are you going to deploy a new rc5 binary version with this fix?
>
If you interested in a binary CVS snapshoot I can send you one.
regards,
Armin
> Thanks,
> Jair Jr
>
>
>>Jair da Silva Ferreira Júnior wrote:
>>
>>>Hi,
>>> I am using ojb1.0_rc5, ODMG api with OJB queries, mysql4 (innodb
>
> tables) in Linux Red Hat 7.3 (kernel 2.4.20-20.7).
>
>>> I moved from rc4 to rc5 recently and I noticed that sometimes when I
>
> run a query the resulting associated objects don't come from the cache.
> Please, take a look at the above code to better undestand what I am saying:
>
>>> Transaction t=implementation.newTransaction();
>>> t.begin();
>>> Person p=new Person();
>>> t.lock(p,t.WRITE);
>>> p.setName("somebody");
>>> Dog d=new Dog();
>>> t.lock(d,t.WRITE);
>>> d.setName("Spike");
>>> p.setDog(d);
>>> t.commit();
>>>
>>> t=implementation.newTransaction();
>>> t.begin();
>>> Criteria crit=new Criteria();
>>> crit.addEqualTo("_id",new Integer(p.getId()));
>>> QueryByCriteria query=QueryFactory.newQuery(Person.class,crit);
>>> PersistenceBroker broker=((HasBroker)t).getBroker();
>>> broker.removeFromCache(p);
>>> Person loaded=(Person)broker.getObjectByQuery(query);
>>> boolean cacheOk=(loaded.getDog()==d); //here cacheOk==false sometimes
>>> t.commit();
>>>
>>> The atributes (proxy, refresh, auto-retrieve, auto-update and
>
> auto-delete) in the reference-descriptor for the association between Person
> and Dog have default values. This way, refresh="false".
>
>>> This problem does not happen everytime. So, sometimes cacheOk==true.
>>> I wasn't able to reproduce this problem in a test case, but it does
>
> happen sometimes.
>
>>> I've used rc4 for a long time and I've never had this kind of
>
> problem.
>
>>> Here's my cache configuration in OJB.properties:
>>>
>>>
>
> ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCacheDefaultImpl
>
>>> descriptorBasedCaches=false
>>>
>>>Thanks,
>>> Jair Jr
>>
>>
>>
>>---------------------------------------------------------------------
>>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
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: cache implementation change in rc5?
Posted by Jair da Silva Ferreira Júnior <j2...@amazon.com.br>.
Hi Armin,
Thank you very much for your fast reply.
> it's a(/my) bug in ObjectCacheDefaultImpl (rc5) causing this strange
> behaviour. I will check in a fixed version tomorrow.
Ok. How can I get the fixed ObjectCacheDefaultImpl implementation? Only
through CVS? Are you going to deploy a new rc5 binary version with this fix?
Thanks,
Jair Jr
>
> Jair da Silva Ferreira Júnior wrote:
> > Hi,
> > I am using ojb1.0_rc5, ODMG api with OJB queries, mysql4 (innodb
tables) in Linux Red Hat 7.3 (kernel 2.4.20-20.7).
> > I moved from rc4 to rc5 recently and I noticed that sometimes when I
run a query the resulting associated objects don't come from the cache.
Please, take a look at the above code to better undestand what I am saying:
> >
> > Transaction t=implementation.newTransaction();
> > t.begin();
> > Person p=new Person();
> > t.lock(p,t.WRITE);
> > p.setName("somebody");
> > Dog d=new Dog();
> > t.lock(d,t.WRITE);
> > d.setName("Spike");
> > p.setDog(d);
> > t.commit();
> >
> > t=implementation.newTransaction();
> > t.begin();
> > Criteria crit=new Criteria();
> > crit.addEqualTo("_id",new Integer(p.getId()));
> > QueryByCriteria query=QueryFactory.newQuery(Person.class,crit);
> > PersistenceBroker broker=((HasBroker)t).getBroker();
> > broker.removeFromCache(p);
> > Person loaded=(Person)broker.getObjectByQuery(query);
> > boolean cacheOk=(loaded.getDog()==d); //here cacheOk==false sometimes
> > t.commit();
> >
> > The atributes (proxy, refresh, auto-retrieve, auto-update and
auto-delete) in the reference-descriptor for the association between Person
and Dog have default values. This way, refresh="false".
> >
> > This problem does not happen everytime. So, sometimes cacheOk==true.
> > I wasn't able to reproduce this problem in a test case, but it does
happen sometimes.
> >
> > I've used rc4 for a long time and I've never had this kind of
problem.
> >
> > Here's my cache configuration in OJB.properties:
> >
> >
ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCacheDefaultImpl
> > descriptorBasedCaches=false
> >
> > Thanks,
> > Jair Jr
>
>
>
> ---------------------------------------------------------------------
> 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
Re: cache implementation change in rc5?
Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi Jair Jr,
it's a(/my) bug in ObjectCacheDefaultImpl (rc5) causing this strange
behaviour. I will check in a fixed version tomorrow.
More info see thread 'Usage WeakHashMap in AnonymousPersistentField Re:
Cache and prefetched relationships'
regards,
Armin
Jair da Silva Ferreira Júnior wrote:
> Hi,
> I am using ojb1.0_rc5, ODMG api with OJB queries, mysql4 (innodb tables) in Linux Red Hat 7.3 (kernel 2.4.20-20.7).
> I moved from rc4 to rc5 recently and I noticed that sometimes when I run a query the resulting associated objects don't come from the cache. Please, take a look at the above code to better undestand what I am saying:
>
> Transaction t=implementation.newTransaction();
> t.begin();
> Person p=new Person();
> t.lock(p,t.WRITE);
> p.setName("somebody");
> Dog d=new Dog();
> t.lock(d,t.WRITE);
> d.setName("Spike");
> p.setDog(d);
> t.commit();
>
> t=implementation.newTransaction();
> t.begin();
> Criteria crit=new Criteria();
> crit.addEqualTo("_id",new Integer(p.getId()));
> QueryByCriteria query=QueryFactory.newQuery(Person.class,crit);
> PersistenceBroker broker=((HasBroker)t).getBroker();
> broker.removeFromCache(p);
> Person loaded=(Person)broker.getObjectByQuery(query);
> boolean cacheOk=(loaded.getDog()==d); //here cacheOk==false sometimes
> t.commit();
>
> The atributes (proxy, refresh, auto-retrieve, auto-update and auto-delete) in the reference-descriptor for the association between Person and Dog have default values. This way, refresh="false".
>
> This problem does not happen everytime. So, sometimes cacheOk==true.
> I wasn't able to reproduce this problem in a test case, but it does happen sometimes.
>
> I've used rc4 for a long time and I've never had this kind of problem.
>
> Here's my cache configuration in OJB.properties:
>
> ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCacheDefaultImpl
> descriptorBasedCaches=false
>
> Thanks,
> Jair Jr
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org