Hi David, Recently, someone posted how to re-assign the code changes from one JIRA to another when a mistake like this happens. But, now I can't find the posting. Does anybody know the magic incantations to get this cleaned up? Thanks.
Kevin On Thu, Apr 16, 2009 at 7:05 PM, David Ezzio <[email protected]> wrote: > Due to my thinking one thing and typing another, the patch applies to > OpenJPA-1006, NOT OpenJPA-1002. > > David > > > [email protected] wrote: > >> Author: dezzio >> Date: Thu Apr 16 23:27:02 2009 >> New Revision: 765801 >> >> URL: http://svn.apache.org/viewvc?rev=765801&view=rev >> Log: >> Fix for OpenJPA-1002, patch submitted by Ravi Palacherla >> >> Added: >> >> >> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestQueryResultSize.java >> (with props) >> Modified: >> >> >> openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryCacheStoreQuery.java >> >> Modified: >> openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryCacheStoreQuery.java >> URL: >> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryCacheStoreQuery.java?rev=765801&r1=765800&r2=765801&view=diff >> >> ============================================================================== >> --- >> openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryCacheStoreQuery.java >> (original) >> +++ >> openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryCacheStoreQuery.java >> Thu Apr 16 23:27:02 2009 >> @@ -289,7 +289,8 @@ >> public Executor newDataStoreExecutor(ClassMetaData meta, boolean >> subs) { >> Executor ex = _query.newDataStoreExecutor(meta, subs); >> - return new QueryCacheExecutor(ex, meta, subs); >> + return new QueryCacheExecutor(ex, meta, subs, >> + getContext().getFetchConfiguration()); >> } >> public boolean supportsAbstractExecutors() { >> @@ -322,12 +323,14 @@ >> private final Executor _ex; >> private final Class _candidate; >> private final boolean _subs; >> + private final FetchConfiguration _fc; >> public QueryCacheExecutor(Executor ex, ClassMetaData meta, >> - boolean subs) { >> + boolean subs, FetchConfiguration fc) { >> _ex = ex; >> _candidate = (meta == null) ? null : meta.getDescribedType(); >> _subs = subs; >> + _fc = fc; >> } >> public ResultObjectProvider executeQuery(StoreQuery q, Object[] >> params, >> @@ -342,7 +345,10 @@ >> ResultObjectProvider rop = >> _ex.executeQuery(cq.getDelegate(), >> params, range); >> - return cq.wrapResult(rop, key); >> + if (_fc.getQueryCacheEnabled()) >> + return cq.wrapResult(rop, key); >> + else >> + return rop; >> } >> /** >> @@ -694,8 +700,8 @@ >> public final Object oid; >> public CachedObjectId (Object oid) >> - { >> - this.oid = oid; >> - } >> - } >> + { >> + this.oid = oid; >> + } >> + } >> } >> >> Added: >> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestQueryResultSize.java >> URL: >> http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestQueryResultSize.java?rev=765801&view=auto >> >> ============================================================================== >> --- >> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestQueryResultSize.java >> (added) >> +++ >> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestQueryResultSize.java >> Thu Apr 16 23:27:02 2009 >> @@ -0,0 +1,84 @@ >> +/* >> + * Licensed to the Apache Software Foundation (ASF) under one >> + * or more contributor license agreements. See the NOTICE file >> + * distributed with this work for additional information >> + * regarding copyright ownership. The ASF licenses this file >> + * to you under the Apache License, Version 2.0 (the >> + * "License"); you may not use this file except in compliance >> + * with the License. You may obtain a copy of the License at >> + * >> + * http://www.apache.org/licenses/LICENSE-2.0 >> + * >> + * Unless required by applicable law or agreed to in writing, >> + * software distributed under the License is distributed on an >> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY >> + * KIND, either express or implied. See the License for the >> + * specific language governing permissions and limitations >> + * under the License. >> + */ >> +package org.apache.openjpa.persistence.datacache; >> + >> +import java.util.HashMap; >> +import java.util.Iterator; >> +import java.util.List; >> +import java.util.Map; >> +import javax.persistence.EntityManagerFactory; >> +import org.apache.openjpa.datacache.*; >> +import javax.persistence.*; >> +import org.apache.openjpa.persistence.*; >> + >> + >> +import org.apache.openjpa.persistence.datacache.common.apps.CacheObjectE; >> +import org.apache.openjpa.persistence.common.utils.AbstractTestCase; >> + >> +import org.apache.openjpa.persistence.OpenJPAEntityManager; >> +import org.apache.openjpa.persistence.OpenJPAQuery; >> + >> +public class TestQueryResultSize >> + extends AbstractTestCase { >> + >> + public TestQueryResultSize(String test) { >> + super(test, "datacachecactusapp"); >> + } >> + >> + private EntityManagerFactory _pmf; >> + private OpenJPAEntityManager pm; >> + >> + public void setUp() { >> + System.out.println("****Deleted Records " >> + + deleteAll(CacheObjectE.class)); >> + Map propsMap = new HashMap(); >> + propsMap.put("openjpa.DataCache", "true"); >> + propsMap.put("openjpa.QueryCache", "true"); >> + propsMap.put("openjpa.RemoteCommitProvider", "sjvm"); >> + _pmf = getEmf(propsMap); >> + } >> + >> + public void test() { >> + CacheObjectE pc1 = new CacheObjectE(); >> + pc1.setStr("pc1"); >> + >> + pm = (OpenJPAEntityManager) _pmf.createEntityManager(); >> + >> + startTx(pm); >> + pm.persist(pc1); >> + endTx(pm); >> + >> + pm.getFetchPlan().setQueryResultCacheEnabled(false); >> + OpenJPAQuery q = pm.createQuery( >> + "select a FROM " + CacheObjectE.class.getSimpleName() + >> + " a where a.str = 'pc1'"); >> + List res = (List) q.getResultList(); >> + assertEquals(0, getQueryCacheSize()); >> + endEm(pm); >> + >> + System.out.println("****Deleted Records " + + >> deleteAll(CacheObjectE.class)); >> + } >> + >> + private int getQueryCacheSize() { >> + return ( ((ConcurrentQueryCache)(OpenJPAPersistence.cast( >> + >> pm.getEntityManagerFactory()).getQueryResultCache().getDelegate())). >> + getCacheMap().size()); >> + } >> +} >> >> Propchange: >> openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestQueryResultSize.java >> >> ------------------------------------------------------------------------------ >> svn:eol-style = native >> >> >> >>
