Afsaneh -

Honestly, I'm not sure how a plain Object is making it's way into the
QueryCache as a key. Is it possible for you to try this on trunk, or come up
with a reproducible unit test for me?

Thanks,
Rick

On Tue, May 3, 2011 at 4:36 AM, afsaneh <[email protected]> wrote:

> Hi Rick,
> I just set the properties as the below in persistence.xml and no more else:
> <property name="openjpa.DataCache" value="true(CacheSize=30000)" />
>  <property name="openjpa.RemoteCommitProvider" value="sjvm" />
>
> Also when my application is initializing, I'm trying to pin some named
> queries with the following code in a servlet:
>        // looking up to find entityManagerFactory from glassfish
>        InvocationManager invMgr =
> Switch.getSwitch().getInvocationManager();
>        ComponentInvocation inv = invMgr.getCurrentInvocation();
>        EntityManagerFactory emf = null;
>        if (inv != null) {
>             Object descriptor =
> Switch.getSwitch().getDescriptorFor(inv.getContainerContext());
>             emf =
>
> EntityManagerFactoryWrapper.lookupEntityManagerFactory(inv.getInvocationType(),
>                         PERSISTENCE_UNIT_NAME, descriptor);
>        }
>
>        OpenJPAEntityManagerFactory ojemf =
> (OpenJPAEntityManagerFactory)emf;
>        QueryResultCache queryResultCache= ojemf.getQueryResultCache();
>
>        EntityManager entityManager =emf.createEntityManager();
>        for(String queryName: namedQueries){
>                Query query = entityManager.createNamedQuery(queryName);
>                queryResultCache.pin(query);
>        }
>
> Thanks for your attention,
> Afsaneh
>

Reply via email to