Return-Path: X-Original-To: apmail-openjpa-dev-archive@www.apache.org Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 404E8D9F0 for ; Tue, 11 Dec 2012 15:39:28 +0000 (UTC) Received: (qmail 3369 invoked by uid 500); 11 Dec 2012 15:39:24 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 2958 invoked by uid 500); 11 Dec 2012 15:39:24 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 754 invoked by uid 99); 11 Dec 2012 15:39:21 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Dec 2012 15:39:21 +0000 Date: Tue, 11 Dec 2012 15:39:21 +0000 (UTC) From: "fabio martelli (JIRA)" To: dev@openjpa.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (OPENJPA-2302) Slice support for QueryCompilationCache MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/OPENJPA-2302?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] fabio martelli updated OPENJPA-2302: ------------------------------------ Attachment: (was: patch.diff) > Slice support for QueryCompilationCache > --------------------------------------- > > Key: OPENJPA-2302 > URL: https://issues.apache.org/jira/browse/OPENJPA-2302 > Project: OpenJPA > Issue Type: Improvement > Components: slice > Affects Versions: 2.3.0, 2.2.1 > Reporter: fabio martelli > Fix For: 2.3.0 > > > It seems that slice doesn't support QueryCompilationCache. > By running the following test case ... > public class TestQueryCompilationCache extends SliceTestCase { > /** > * Specify persistence unit name as System property > * -Dunit or use the default value as > * "slice". > */ > protected String getPersistenceUnitName() { > return System.getProperty("unit", "slice"); > } > @Override > public void setUp() { > super.setUp(PObject.class, > "openjpa.QueryCompilationCache", "true"); > } > public void testQueryCompilationCache() > throws Exception { > OpenJPAEntityManager em = emf.createEntityManager(); > em.getTransaction().begin(); > em.createQuery("SELECT o from PObject o").getResultList(); > em.getTransaction().commit(); > em.close(); > em = emf.createEntityManager(); > em.createQuery("SELECT o from PObject o").getResultList(); > em.close(); > emf.close(); > } > } > The following exception will be raised. > testQueryCompilationCache(org.apache.openjpa.slice.TestQueryCompilationCache) Time elapsed: 1.923 sec <<< ERROR! > org.apache.openjpa.persistence.PersistenceException: The context has been closed. The stack trace at which the context was closed is available if Runtime=TRACE logging is enabled. > at org.apache.openjpa.slice.jdbc.DistributedStoreQuery$ParallelExecutor.executeQuery(DistributedStoreQuery.java:156) > at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:1005) > at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:863) > at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:794) > at org.apache.openjpa.slice.DistributedQueryImpl.execute(DistributedQueryImpl.java:61) > at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:542) > at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:286) > at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:302) > at org.apache.openjpa.slice.TestQueryCompilationCache.testQueryCompilationCache(TestQueryCompilationCache.java:57) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at junit.framework.TestCase.runTest(TestCase.java:154) > at junit.framework.TestCase.runBare(TestCase.java:127) > at junit.framework.TestResult$1.protect(TestResult.java:106) > at junit.framework.TestResult.runProtected(TestResult.java:124) > at junit.framework.TestResult.run(TestResult.java:109) > at junit.framework.TestCase.run(TestCase.java:118) > at org.apache.openjpa.slice.PersistenceTestCase.run(PersistenceTestCase.java:124) > at junit.framework.TestSuite.runTest(TestSuite.java:208) > at junit.framework.TestSuite.run(TestSuite.java:203) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:213) > at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:115) > at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:102) > at org.apache.maven.surefire.Surefire.run(Surefire.java:180) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350) > at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021) > Caused by: org.apache.openjpa.persistence.InvalidStateException: The context has been closed. The stack trace at which the context was closed is available if Runtime=TRACE logging is enabled. > at org.apache.openjpa.kernel.BrokerImpl.assertOpen(BrokerImpl.java:4683) > at org.apache.openjpa.kernel.QueryImpl.assertOpen(QueryImpl.java:1700) > at org.apache.openjpa.kernel.QueryImpl.isUnique(QueryImpl.java:453) > at org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.calculateEagerMode(JDBCStoreQuery.java:483) > at org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.executeQuery(JDBCStoreQuery.java:174) > at org.apache.openjpa.kernel.ExpressionStoreQuery$DataStoreExecutor.executeQuery(ExpressionStoreQuery.java:783) > at org.apache.openjpa.slice.jdbc.DistributedStoreQuery$QueryExecutor.call(DistributedStoreQuery.java:273) > at org.apache.openjpa.slice.jdbc.DistributedStoreQuery$QueryExecutor.call(DistributedStoreQuery.java:266) > at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) > at java.util.concurrent.FutureTask.run(FutureTask.java:138) > at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) > at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) > at java.lang.Thread.run(Thread.java:680) -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira