openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From afsaneh <afsaneh.abo...@gmail.com>
Subject Re: cast exception for dataCache.QueryKey in glassfish
Date Tue, 03 May 2011 09:36:37 GMT
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


--
View this message in context: http://openjpa.208410.n2.nabble.com/cast-exception-for-dataCache-QueryKey-in-glassfish-tp6321202p6326710.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message