openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ravi P Palacherla (JIRA)" <>
Subject [jira] Commented: (OPENJPA-1511) Executing a cached query doesn't properly cache results after DataCache eviction
Date Wed, 03 Mar 2010 05:37:27 GMT


Ravi P Palacherla commented on OPENJPA-1511:

Currently there is a way to evict L2Cache when an entity is evicted from L1Cache.
It is achieved by  calling:
EntityManagerImpl.evict(entity) with property 
<property name="openjpa.BrokerImpl" value="EvictFromDataCache=true"/>
The above will make sure that evicting an entity from L1cache will also be evicted form L2cache.

The reverse is not defined anywhere  in openJPA docs and I think the reverse is what is needed
as part of this JIRA.

I do not think it is possible (with my limited knowledge) because of the following reason:
In your testcase you are doing an evict from L2cache. Now the same entity in L2Cache can be
shared by multiple L1cache's.
So an evict from L2cache should be able to find all the L1cache's that share this entity and
should be evicted from all these L1cache's.
I do not think something like this is possible as I may not be able to get to L1cache (entityManager)
from L2cache.

Please let me know if you disagree with any of the above.


> Executing a cached query doesn't properly cache results after DataCache eviction
> --------------------------------------------------------------------------------
>                 Key: OPENJPA-1511
>                 URL:
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 2.0.0-beta
>            Reporter: Rick Curtis
>            Assignee: Ravi P Palacherla
>         Attachments:
> When doing some testing I found that the QueryCache sometimes doesn't put results into
the DataCache. 
> I haven't had time to debug the problem, but I'm opening this JIRA so I can attach the
test case I've created.
> The test scenario is as follows:
> String query = "Select t FROM Item t where 1=1 ORDER BY";
> items = em.createQuery(query,Item.class).getResultList();
> assertTrue(storeCache.contains(Item.class, items.get(0).getId()));
> // Make sure that all of the results are in the DataCache.
> for(Item o : items){
>   assertTrue(storeCache.contains(Item.class, o.getId()));
> }
> storeCache.evict(Item.class,items.get(0).getId());
> // Evict one result
> assertFalse(storeCache.contains(Item.class,items.get(0).getId()));
> // Executing the same query should re-populate the datacache
> items = em.createQuery(query,Item.class).getResultList();
> assertTrue(storeCache.contains(Item.class, items.get(0).getId())); // fails here

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message