You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by pc...@apache.org on 2008/02/15 10:20:40 UTC
svn commit: r627979 [9/39] - in /openjpa/trunk:
openjpa-lib/src/test/java/org/apache/openjpa/lib/test/
openjpa-persistence-jdbc/ openjpa-persistence-jdbc/src/test/java/
openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/
openjpa-pers...
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestResultShapes.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestResultShapes.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestResultShapes.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestResultShapes.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,322 @@
+/*
+ * 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.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import javax.persistence.EntityManagerFactory;
+
+
+import org.apache.openjpa.persistence.datacache.common.apps.CacheObjectAChild1;
+import org.apache.openjpa.persistence.common.utils.AbstractTestCase;
+
+import org.apache.openjpa.kernel.Broker;
+import org.apache.openjpa.kernel.BrokerFactory;
+import org.apache.openjpa.kernel.Query;
+import org.apache.openjpa.kernel.jpql.JPQLParser;
+import org.apache.openjpa.persistence.JPAFacadeHelper;
+import org.apache.openjpa.persistence.OpenJPAEntityManagerFactory;
+
+/**
+ * Test that we marshall and unmarshall result types appropriately.
+ */
+public class TestResultShapes extends AbstractTestCase {
+
+ public TestResultShapes(String test) {
+ super(test, "datacachecactusapp");
+ }
+
+ private Broker _broker;
+
+ public void setUp() {
+ deleteAll(CacheObjectAChild1.class);
+
+ Map propsMap = new HashMap();
+ propsMap.put("openjpa.DataCache", "true");
+ propsMap.put("openjpa.RemoteCommitProvider", "sjvm");
+ EntityManagerFactory emf = getEmf(propsMap);
+ BrokerFactory factory = JPAFacadeHelper.toBrokerFactory(emf);
+
+ Broker broker = factory.newBroker();
+ broker.begin();
+ broker.persist(new CacheObjectAChild1("foo", "foo", 0), null);
+ broker.persist(new CacheObjectAChild1("bar", "bar", 1), null);
+ broker.commit();
+ broker.close();
+
+ _broker = factory.newBroker();
+ }
+
+ public void tearDown() throws Exception {
+ _broker.close();
+
+ super.tearDown();
+ }
+
+ // FIXME Seetha Nov 3,2006
+ // need to know about the 'this' parameter
+
+// public void testCollectionOfCandidateClass()
+// {
+// Collection<String> ac = new ArrayList<String>();
+// ac.add("this");
+//
+// Collection<Class> bd = new ArrayList<Class>();
+// bd.add(CacheObjectAChild1.class);
+//
+// arrayHelper(false, bd, null, true);
+// mapHelper(false, bd, ac, true);
+// rawHelper(false, CacheObjectAChild1.class, null, true);
+// }
+//
+// public void testUniqueCandidateClass()
+// {
+// Collection<String> ac = new ArrayList<String>();
+// ac.add("this");
+//
+// Collection<Class> bd = new ArrayList<Class>();
+// bd.add(CacheObjectAChild1.class);
+//
+// arrayHelper(true, bd, null, true);
+// mapHelper(true, bd, ac, true);
+// rawHelper(true, CacheObjectAChild1.class, null, true);
+// }
+
+ public void testCollectionOfSingleValuedProjection() {
+
+ Collection<String> ac = new ArrayList<String>();
+ ac.add("age");
+
+ Collection<Class> bd = new ArrayList<Class>();
+ bd.add(Long.class);
+
+ arrayHelper(false, bd, ac, true);
+ mapHelper(false, bd, ac, true);
+ rawHelper(false, Long.class, "age", true);
+ }
+
+ public void testUniqueSingleValuedProjection() {
+ Collection<String> ac = new ArrayList<String>();
+ ac.add("age");
+
+ Collection<Class> bd = new ArrayList<Class>();
+ bd.add(Long.class);
+
+ arrayHelper(true, bd, ac, true);
+ mapHelper(true, bd, ac, true);
+ rawHelper(true, Long.class, "age", true);
+ }
+
+ public void testCollectionOfMultiValuedProjection() {
+ Collection<String> ac = new ArrayList<String>();
+ ac.add("age");
+ ac.add("name");
+
+ Collection<Class> bd = new ArrayList<Class>();
+ bd.add(Long.class);
+ bd.add(String.class);
+
+ arrayHelper(false, bd, ac, true);
+
+ mapHelper(false, bd, ac, true);
+ // we put both
+ // projections in single slot in array because this is a
+ // single result that we're
+ // looking
+ // for. It just happens that the // single result format we expect is
+ // an Object[]. rawHelper(false, Object[].class, "age, name", true);
+ }
+
+ public void testUniqueMultiValuedProjection() {
+ Collection<String> ac = new ArrayList<String>();
+ ac.add("age");
+ ac.add("name");
+
+ Collection<Class> bd = new ArrayList<Class>();
+ bd.add(Long.class);
+ bd.add(String.class);
+
+ arrayHelper(true, bd, ac, true);
+ mapHelper(true, bd, ac, true);
+ // we put
+ // both
+ // projections in single slot in array because this is a
+ // single result that
+ // we're looking
+ // for. It just happens that the // single result format we
+ // expect is an Object[]. rawHelper(true, Object[].class, "age, name", true);
+ }
+
+ public void testUncachedQueryHasCorrectShape() {
+ Collection<String> ac = new ArrayList<String>();
+ ac.add("age");
+ ac.add("name");
+
+ Collection<Class> bd = new ArrayList<Class>();
+ bd.add(Long.class);
+ bd.add(String.class);
+
+ _broker.getFetchConfiguration().setQueryCacheEnabled(false);
+
+ arrayHelper(false, bd, ac, false);
+ mapHelper(false, bd, ac, false);
+ rawHelper(false, Object[].class, "age, a.name", false);
+ }
+
+ private void arrayHelper(boolean unique, Collection recordClasses,
+ Collection results, boolean inCache) {
+ Query q = setUpQuery(unique, results);
+ q.setResultType(Object[].class);
+ if (unique) {
+ arrayResultHelper(q.execute(), recordClasses, inCache);
+ } else {
+ for (Iterator iter = ((List) q.execute()).iterator(); iter
+ .hasNext();)
+ arrayResultHelper(iter.next(), recordClasses, inCache);
+ }
+
+ CacheTestHelper.assertInCache(this, q, new Boolean(inCache));
+
+ if (unique) {
+ arrayResultHelper(q.execute(), recordClasses, inCache);
+ } else {
+ for (Iterator iter = ((List) q.execute()).iterator(); iter
+ .hasNext();)
+ arrayResultHelper(iter.next(), recordClasses, inCache);
+ }
+ }
+
+ private void arrayResultHelper(Object result, Collection recordClasses,
+ boolean inCache) {
+ assertEquals(Object[].class, result.getClass());
+ Object[] os = (Object[]) result;
+ assertEquals(recordClasses.size(), os.length);
+ for (int i = 0; i < recordClasses.size(); i++)
+ assertEquals(((ArrayList) recordClasses).get(i), os[i].getClass());
+ }
+
+ private void mapHelper(boolean unique, Collection recordClasses,
+ Collection results, boolean inCache) {
+ Query q = setUpQuery(unique, results);
+ System.out.println("Query String " + q.getQueryString());
+ Collection coll = null;
+ if (q.execute() != null && (q.execute() instanceof Collection)) {
+ coll = (Collection) q.execute();
+ }
+ System.out.println("Type of q.execute is : " + q.execute().getClass());
+
+ Iterator it = coll.iterator();
+ while (it.hasNext())
+ System.out.println("Query result is " + it.next().getClass());
+
+ q.setResultType(HashMap.class);
+
+ if (unique) {
+ mapResultHelper(q.execute(), recordClasses, results, inCache);
+ } else {
+ for (Iterator iter = ((Collection) q.execute()).iterator();
+ iter.hasNext();)
+ mapResultHelper(iter.next(), recordClasses, results, inCache);
+ }
+
+ CacheTestHelper.assertInCache(this, q, new Boolean(inCache));
+
+ if (unique) {
+ mapResultHelper(q.execute(), recordClasses, results, inCache);
+ } else {
+ for (Iterator iter = ((List) q.execute()).iterator(); iter
+ .hasNext();)
+ mapResultHelper(iter.next(), recordClasses, results, inCache);
+ }
+ }
+
+ private void mapResultHelper(Object result, Collection recordClasses,
+ Collection results, boolean inCache) {
+ assertEquals(HashMap.class, result.getClass());
+ HashMap m = (HashMap) result;
+ assertEquals(recordClasses.size(), m.size());
+ for (int i = 0; i < recordClasses.size(); i++)
+ assertEquals("Map Contents " + m.toString() + " result: " + result
+ + " loop size: " + recordClasses.size()
+ + "Value of m.get(results[i]) "
+ + m.get(((ArrayList) results).get(i).getClass()),
+ ((ArrayList) recordClasses).get(i),
+ m.get("jpqlalias" + (i + 1)).getClass());
+ }
+
+ private void rawHelper(boolean unique, Class recordClass, String result,
+ boolean inCache) {
+ ArrayList<String> l = new ArrayList<String>();
+ l.add(result);
+ Collection res = (result == null) ? null : l;
+ Query q = setUpQuery(unique, res);
+ if (unique)
+ assertEquals(recordClass, q.execute().getClass());
+ else {
+ q.setUnique(unique);
+ for (Iterator iter = ((List) q.execute()).iterator(); iter
+ .hasNext();)
+ assertEquals(recordClass, iter.next().getClass());
+ }
+
+ CacheTestHelper.assertInCache(this, q, new Boolean(inCache));
+
+ if (unique) {
+ assertEquals(recordClass, q.execute().getClass());
+ } else {
+ for (Iterator iter = ((List) q.execute()).iterator(); iter
+ .hasNext();)
+ assertEquals(recordClass, iter.next().getClass());
+ }
+ }
+
+ private Query setUpQuery(boolean unique, Collection results) {
+ String filter = "select";
+ ArrayList resultsl = (ArrayList) results;
+ if (results != null) {
+ String resultString = "";
+ for (int i = 0; i < resultsl.size(); i++) {
+ resultString += "a." + resultsl.get(i);
+ if (i < results.size() - 1)
+ resultString += ", ";
+ }
+ filter += " " + resultString;
+ filter += " " + "from "
+ + CacheObjectAChild1.class.getSuperclass().getSimpleName()
+ + " a";
+ } else {
+ filter += " " + "a from "
+ + CacheObjectAChild1.class.getSuperclass().getSimpleName()
+ + " a";
+ }
+
+ if (unique)
+ filter += " where a.age = 0";
+ System.out.println("****Query: " + filter);
+ Query q = _broker.newQuery(JPQLParser.LANG_JPQL, filter);
+ q.setUnique(unique);
+ q.setCandidateType(CacheObjectAChild1.class, false);
+
+ return q;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestSJVMCache.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestSJVMCache.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestSJVMCache.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestSJVMCache.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,53 @@
+/*
+ * 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;
+
+/**
+ * Test data caching across multiple factories in the same JVM, using
+ * the single-JVM commit provider to communicate updates..
+ */
+public class TestSJVMCache
+ extends CacheTest {
+
+ public TestSJVMCache(String test) {
+ super(test);
+ }
+
+ protected String[] getConfs() {
+ return new String[]{
+ // the second cache is there solely to differentiate between
+ // this PMF and the PMF created from confs2 below
+ "openjpa.DataCache", "true, true(Name=differentiatingProperty1)",
+ "openjpa.QueryCache", "true",
+ "openjpa.RemoteCommitProvider", "sjvm",
+ "openjpa.BrokerImpl", CacheTestBroker.class.getName(),
+ };
+ }
+
+ protected String[] getConfs2() {
+ return new String[]{
+ // the second cache is there solely to differentiate between
+ // this PMF and the PMF created from confs above
+ "openjpa.DataCache", "true, true(Name=differentiatingProperty2)",
+ "openjpa.QueryCache", "true",
+ "openjpa.RemoteCommitProvider", "sjvm",
+ "openjpa.BrokerImpl", CacheTestBroker.class.getName(),
+ };
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestUniteratedQueryResult.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestUniteratedQueryResult.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestUniteratedQueryResult.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestUniteratedQueryResult.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,102 @@
+/*
+ * 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.persistence.datacache.common.apps.CacheObjectA;
+import org.apache.openjpa.persistence.common.utils.AbstractTestCase;
+
+import org.apache.openjpa.persistence.OpenJPAEntityManager;
+import org.apache.openjpa.persistence.OpenJPAQuery;
+
+public class TestUniteratedQueryResult
+ extends AbstractTestCase {
+
+ public TestUniteratedQueryResult(String test) {
+ super(test, "datacachecactusapp");
+ }
+
+ private EntityManagerFactory _pmf;
+
+ public void setUp() {
+ System.out.println("****Deleted Records "
+ + deleteAll(CacheObjectA.class));
+ Map propsMap = new HashMap();
+ propsMap.put("openjpa.DataCache", "true");
+ propsMap.put("openjpa.QueryCache", "true");
+ propsMap.put("openjpa.RemoteCommitProvider", "sjvm");
+ propsMap.put("openjpa.FetchBatchSize", "0");
+
+ _pmf = getEmf(propsMap);
+ }
+
+ public void test() {
+ CacheObjectA pc1 = new CacheObjectA();
+ pc1.setName("pc1");
+ CacheObjectA pc2 = new CacheObjectA();
+ pc2.setName("pc2");
+ OpenJPAEntityManager pm =
+ (OpenJPAEntityManager) _pmf.createEntityManager();
+ startTx(pm);
+ pm.persist(pc1);
+ pm.persist(pc2);
+ endTx(pm);
+ Object oid1 = pm.getObjectId(pc1);
+ Object oid2 = pm.getObjectId(pc2);
+ endEm(pm);
+
+ pm = (OpenJPAEntityManager) _pmf.createEntityManager();
+
+ OpenJPAQuery q = pm.createQuery(
+ "select a FROM " + CacheObjectA.class.getSimpleName() +
+ " a where a.name = 'pc1'");
+ List res = (List) q.getResultList();
+
+ OpenJPAEntityManager pm2 =
+ (OpenJPAEntityManager) _pmf.createEntityManager();
+ startTx(pm2);
+ pc1 = (CacheObjectA) pm2.find(CacheObjectA.class, oid1);
+ pc2 = (CacheObjectA) pm2.find(CacheObjectA.class, oid2);
+ pc1.setName("pc2");
+ pc2.setName("pc1");
+ endTx(pm2);
+
+ assertEquals(1, res.size());
+ for (Iterator itr = res.iterator(); itr.hasNext();)
+ assertEquals(oid1, pm2.getObjectId(itr.next()));
+ endEm(pm2);
+ endEm(pm);
+
+ pm = (OpenJPAEntityManager) _pmf.createEntityManager();
+
+ q = pm.createQuery(
+ "select a FROM " + CacheObjectA.class.getSimpleName() +
+ " a where a.name = 'pc1'");
+ res = (List) q.getResultList();
+
+ assertEquals(oid2, pm.getObjectId(res.iterator().next()));
+ endEm(pm);
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/AppIdCacheObject.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/AppIdCacheObject.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/AppIdCacheObject.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/AppIdCacheObject.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,38 @@
+/*
+ * 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.common.apps;
+
+import javax.persistence.Entity;
+
+@Entity
+public class AppIdCacheObject {
+
+ private int id;
+
+ protected AppIdCacheObject() {
+ }
+
+ public AppIdCacheObject(int id) {
+ this.id = id;
+ }
+
+ public int getId() {
+ return id;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/AttachA.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/AttachA.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/AttachA.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/AttachA.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,86 @@
+/*
+ * 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.common.apps;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import javax.persistence.Entity;
+
+@Entity
+public class AttachA
+ implements Serializable {
+
+ private String astr;
+ private int aint;
+ private double adbl;
+ private String[] stringArray = new String[0];
+ private AttachE[] attachEArray = new AttachE[0];
+
+ public void setAstr(String astr) {
+ this.astr = astr;
+ }
+
+ public String getAstr() {
+ return this.astr;
+ }
+
+ public void setAint(int aint) {
+ this.aint = aint;
+ }
+
+ public int getAint() {
+ return this.aint;
+ }
+
+ public void setAdbl(double adbl) {
+ this.adbl = adbl;
+ }
+
+ public double getAdbl() {
+ return this.adbl;
+ }
+
+ public void setStringArray(String[] stringArray) {
+ this.stringArray = stringArray;
+ }
+
+ public String[] getStringArray() {
+ return this.stringArray;
+ }
+
+ public void setAttachEArray(AttachE[] attachEArray) {
+ this.attachEArray = attachEArray;
+ }
+
+ public AttachE[] getAttachEArray() {
+ return this.attachEArray;
+ }
+
+ private void writeObject(ObjectOutputStream out)
+ throws IOException {
+ out.defaultWriteObject();
+ }
+
+ private void readObject(ObjectInputStream in)
+ throws IOException, ClassNotFoundException {
+ in.defaultReadObject();
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/AttachB.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/AttachB.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/AttachB.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/AttachB.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,76 @@
+/*
+ * 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.common.apps;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import javax.persistence.Entity;
+
+@Entity
+public class AttachB
+ extends AttachA {
+
+ private String bstr;
+ private int bint;
+ private double bdbl;
+ private Set ds = new HashSet();
+ private Map stringIntMap = new TreeMap();
+
+ public void setBstr(String bstr) {
+ this.bstr = bstr;
+ }
+
+ public String getBstr() {
+ return this.bstr;
+ }
+
+ public void setBint(int bint) {
+ this.bint = bint;
+ }
+
+ public int getBint() {
+ return this.bint;
+ }
+
+ public void setBdbl(double bdbl) {
+ this.bdbl = bdbl;
+ }
+
+ public double getBdbl() {
+ return this.bdbl;
+ }
+
+ public void setDs(Set ds) {
+ this.ds = ds;
+ }
+
+ public Set getDs() {
+ return this.ds;
+ }
+
+ public void setStringIntMap(Map stringIntMap) {
+ this.stringIntMap = stringIntMap;
+ }
+
+ public Map getStringIntMap() {
+ return this.stringIntMap;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/AttachC.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/AttachC.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/AttachC.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/AttachC.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,65 @@
+/*
+ * 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.common.apps;
+
+import java.util.LinkedList;
+import java.util.List;
+import javax.persistence.Entity;
+
+@Entity
+public class AttachC
+ extends AttachB {
+
+ private String cstr;
+ private int cint;
+ private double cdbl;
+ private List es = new LinkedList(); // non-DFG
+
+ public void setCstr(String cstr) {
+ this.cstr = cstr;
+ }
+
+ public String getCstr() {
+ return this.cstr;
+ }
+
+ public void setCint(int cint) {
+ this.cint = cint;
+ }
+
+ public int getCint() {
+ return this.cint;
+ }
+
+ public void setCdbl(double cdbl) {
+ this.cdbl = cdbl;
+ }
+
+ public double getCdbl() {
+ return this.cdbl;
+ }
+
+ public void setEs(List es) {
+ this.es = es;
+ }
+
+ public List getEs() {
+ return this.es;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/AttachD.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/AttachD.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/AttachD.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/AttachD.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,121 @@
+/*
+ * 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.common.apps;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+import javax.persistence.Entity;
+
+@Entity
+public class AttachD
+ implements Serializable {
+
+ private Object version;
+
+ private String dstr;
+ private int dint;
+ private double ddbl;
+ private AttachA a;
+ private Set bs = new HashSet(); // DFG
+ private Map pcStringMap = new HashMap();
+ private TreeMap bigIntegerPCMap = new TreeMap();
+
+ private AttachE embeddedE;
+ private AttachA embeddedA;
+
+ public void setDstr(String dstr) {
+ this.dstr = dstr;
+ }
+
+ public String getDstr() {
+ return this.dstr;
+ }
+
+ public void setDint(int dint) {
+ this.dint = dint;
+ }
+
+ public int getDint() {
+ return this.dint;
+ }
+
+ public void setDdbl(double ddbl) {
+ this.ddbl = ddbl;
+ }
+
+ public double getDdbl() {
+ return this.ddbl;
+ }
+
+ public AttachA getA() {
+ return a;
+ }
+
+ public void setA(AttachA a) {
+ this.a = a;
+ }
+
+ public void setBs(Set bs) {
+ this.bs = bs;
+ }
+
+ public Set getBs() {
+ return this.bs;
+ }
+
+ public void setPcStringMap(Map pcStringMap) {
+ this.pcStringMap = pcStringMap;
+ }
+
+ public Map getPcStringMap() {
+ return this.pcStringMap;
+ }
+
+ public void setBigIntegerPCMap(TreeMap bigIntegerPCMap) {
+ this.bigIntegerPCMap = bigIntegerPCMap;
+ }
+
+ public TreeMap getBigIntegerPCMap() {
+ return this.bigIntegerPCMap;
+ }
+
+ public void setEmbeddedE(AttachE embeddedE) {
+ this.embeddedE = embeddedE;
+ }
+
+ public AttachE getEmbeddedE() {
+ return this.embeddedE;
+ }
+
+ public void setEmbeddedA(AttachA embeddedA) {
+ this.embeddedA = embeddedA;
+ }
+
+ public AttachA getEmbeddedA() {
+ return this.embeddedA;
+ }
+
+ public Object getVersion() {
+ return this.version;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/AttachE.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/AttachE.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/AttachE.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/AttachE.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,85 @@
+/*
+ * 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.common.apps;
+
+import java.io.Serializable;
+import java.util.Date;
+import javax.persistence.Entity;
+
+@Entity
+public class AttachE
+ implements Serializable {
+
+ private Object version;
+
+ private String estr;
+ private int eint;
+ private double edbl;
+ private AttachB b;
+ private AttachF f;
+ private Date date;
+
+ public void setEstr(String estr) {
+ this.estr = estr;
+ }
+
+ public String getEstr() {
+ return this.estr;
+ }
+
+ public void setEint(int eint) {
+ this.eint = eint;
+ }
+
+ public int getEint() {
+ return this.eint;
+ }
+
+ public void setEdbl(double edbl) {
+ this.edbl = edbl;
+ }
+
+ public double getEdbl() {
+ return this.edbl;
+ }
+
+ public void setB(AttachB b) {
+ this.b = b;
+ }
+
+ public AttachB getB() {
+ return this.b;
+ }
+
+ public void setF(AttachF f) {
+ this.f = f;
+ }
+
+ public AttachF getF() {
+ return this.f;
+ }
+
+ public void setDate(Date date) {
+ this.date = date;
+ }
+
+ public Date getDate() {
+ return this.date;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/AttachF.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/AttachF.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/AttachF.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/AttachF.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,135 @@
+/*
+ * 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.common.apps;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+import javax.persistence.Entity;
+
+@Entity
+public class AttachF
+ implements Serializable {
+
+ private int id1;
+ private String id2;
+
+ private String fstr;
+ private int fint;
+ private double fdbl;
+ private AttachE e;
+ private List strings = new ArrayList();
+
+ private AttachC embeddedC;
+
+ public void setFstr(String fstr) {
+ this.fstr = fstr;
+ }
+
+ public String getFstr() {
+ return this.fstr;
+ }
+
+ public void setFint(int fint) {
+ this.fint = fint;
+ }
+
+ public int getFint() {
+ return this.fint;
+ }
+
+ public void setFdbl(double fdbl) {
+ this.fdbl = fdbl;
+ }
+
+ public double getFdbl() {
+ return this.fdbl;
+ }
+
+ public void setE(AttachE e) {
+ this.e = e;
+ }
+
+ public AttachE getE() {
+ return this.e;
+ }
+
+ public void setStrings(List strings) {
+ this.strings = strings;
+ }
+
+ public List getStrings() {
+ return this.strings;
+ }
+
+ public static class ID {
+
+ public int id1;
+ public String id2;
+
+ public ID() {
+ }
+
+ public ID(String str) {
+ StringTokenizer tok = new StringTokenizer(str, ":");
+ id1 = Integer.parseInt(tok.nextToken());
+ id2 = tok.nextToken();
+ }
+
+ public int hashCode() {
+ return id1 + (id2 == null ? 0 : id2.hashCode());
+ }
+
+ public String toString() {
+ return id1 + ":" + id2;
+ }
+
+ public boolean equals(Object other) {
+ return other instanceof ID
+ && ((ID) other).id1 == id1
+ && (id2 == null ? ((ID) other).id2 == null
+ : id2.equals(((ID) other).id2));
+ }
+ }
+
+ public void setId1(int id1) {
+ this.id1 = id1;
+ }
+
+ public int getId1() {
+ return this.id1;
+ }
+
+ public void setId2(String id2) {
+ this.id2 = id2;
+ }
+
+ public String getId2() {
+ return this.id2;
+ }
+
+ public void setEmbeddedC(AttachC embeddedC) {
+ this.embeddedC = embeddedC;
+ }
+
+ public AttachC getEmbeddedC() {
+ return this.embeddedC;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectA.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectA.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectA.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectA.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,263 @@
+/*
+ * 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.common.apps;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.Locale;
+import javax.persistence.CascadeType;
+import javax.persistence.DiscriminatorColumn;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToOne;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.apache.openjpa.persistence.PersistentCollection;
+import org.apache.openjpa.persistence.jdbc.ContainerTable;
+import org.apache.openjpa.persistence.jdbc.ElementJoinColumn;
+import org.apache.openjpa.persistence.jdbc.OrderColumn;
+import org.apache.openjpa.persistence.jdbc.XJoinColumn;
+
+/**
+ * Used in testing; should be enhanced.
+ */
+@Entity
+@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
+@DiscriminatorColumn(name = "TYP")
+@DiscriminatorValue("CACHE_A")
+public class CacheObjectA {
+
+ private String name = null;
+
+ private long age = 0;
+
+ @ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
+ private CacheObjectA relatedObj = null;
+
+ @PersistentCollection
+ @ContainerTable(name = "CACHE_STRINGCOLL",
+ joinColumns = @XJoinColumn(name = "ID"))
+ @ElementJoinColumn(name = "ELEMENT")
+ /*
+ * @ManyToMany @JoinTable(name="CACHE_STRINGCOLL",
+ * joinColumns=@JoinColumn(name="ID"),
+ * inverseJoinColumns=@JoinColumn(name="ELEMENT"))
+ */
+ private Collection<String> stringColl = new LinkedList();
+
+ /*
+ * @ManyToMany @JoinTable(name="CACHE_RELATEDCOLL",
+ * joinColumns=@JoinColumn(name="ID"),
+ * inverseJoinColumns=@JoinColumn(name="ELEMENT"))
+ */
+ @PersistentCollection
+ @ContainerTable(name = "CACHE_RELATEDCOLL",
+ joinColumns = @XJoinColumn(name = "ID"))
+ @ElementJoinColumn(name = "ELEMENT")
+ private Collection<CacheObjectA> relatedColl = new LinkedList();
+
+ /*
+ * @PersistentCollection @ContainerTable(name="CACHE_AS",
+ * joinColumns=@XJoinColumn(name="ID")) @ElementJoinColumn(name="ELEMENT")
+ * @OrderColumn(name="ORDR")
+ */
+ @ManyToMany
+ @JoinTable(name = "CACHE_AS", joinColumns = @JoinColumn(name = "ID"),
+ inverseJoinColumns = @JoinColumn(name = "ELEMENT"))
+ private CacheObjectA[] as;
+
+ @PersistentCollection
+ @ContainerTable(name = "CACHE_STRINGARRAY",
+ joinColumns = @XJoinColumn(name = "ID"))
+ @ElementJoinColumn(name = "ELEMENT")
+ @OrderColumn(name = "ORDR")
+ /*
+ * @ManyToMany @JoinTable(name="CACHE_STRINGARRAY",
+ * joinColumns=@JoinColumn(name="ID"),
+ * inverseJoinColumns=@JoinColumn(name="ELEMENT"))
+ */
+ private String[] stringArray;
+
+ @PersistentCollection
+ @ContainerTable(name = "CACHE_PRIMITIVEARRAY",
+ joinColumns = @XJoinColumn(name = "ID"))
+ @ElementJoinColumn(name = "ELEMENT")
+ @OrderColumn(name = "ORDR")
+ /*
+ * @ManyToMany @JoinTable(name="CACHE_PRIMITIVEARRAY",
+ * joinColumns=@JoinColumn(name="ID"),
+ * inverseJoinColumns=@JoinColumn(name="ELEMENT"))
+ */
+ private float[] primitiveArray;
+
+ @PersistentCollection
+ @ContainerTable(name = "CACHE_DATEARRAY",
+ joinColumns = @XJoinColumn(name = "ID"))
+ @ElementJoinColumn(name = "ELEMENT")
+ @OrderColumn(name = "ORDR")
+ /*
+ * @ManyToMany @JoinTable(name="CACHE_DATEARRAY",
+ * joinColumns=@JoinColumn(name="ID"),
+ * inverseJoinColumns=@JoinColumn(name="ELEMENT"))
+ */
+ private Date[] dateArray;
+
+ @Temporal(TemporalType.DATE)
+ private Date date;
+
+ private Locale locale;
+
+ @ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
+ private CacheObjectB relatedB = null;
+
+ @OneToOne(fetch = FetchType.LAZY, cascade = { CascadeType.ALL })
+ private CacheObjectInterface relatedInterface = null;
+
+ public CacheObjectA() {
+ }
+
+ public CacheObjectA(String name, long age) {
+ this.name = name;
+ this.age = age;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public long getAge() {
+ return age;
+ }
+
+ public void setAge(long age) {
+ this.age = age;
+ }
+
+ public CacheObjectA getRelatedObject() {
+ return relatedObj;
+ }
+
+ public void setRelatedObject(CacheObjectA o) {
+ relatedObj = o;
+ }
+
+ public Collection getStringCollection() {
+ return stringColl;
+ }
+
+ public void setStringCollection(Collection coll) {
+ stringColl = coll;
+ }
+
+ public Collection getRelatedCollection() {
+ return relatedColl;
+ }
+
+ public void setRelatedCollection(Collection coll) {
+ relatedColl = coll;
+ }
+
+ public CacheObjectA[] getRelatedArray() {
+ return as;
+ }
+
+ public void setRelatedArray(CacheObjectA[] array) {
+ as = array;
+ }
+
+ public String[] getStringArray() {
+ return stringArray;
+ }
+
+ public void setStringArray(String[] array) {
+ stringArray = array;
+ }
+
+ public void setPrimitiveArray(float[] val) {
+ primitiveArray = val;
+ }
+
+ public float[] getPrimitiveArray() {
+ return primitiveArray;
+ }
+
+ public void setDateArray(Date[] val) {
+ dateArray = val;
+ }
+
+ public Date[] getDateArray() {
+ return dateArray;
+ }
+
+ public void setDate(Date val) {
+ date = val;
+ }
+
+ public Date getDate() {
+ return date;
+ }
+
+ public void setLocale(Locale val) {
+ locale = val;
+ }
+
+ public Locale getLocale() {
+ return locale;
+ }
+
+ public void setRelatedB(CacheObjectB val) {
+ relatedB = val;
+ }
+
+ public CacheObjectB getRelatedB() {
+ return relatedB;
+ }
+
+ public void setRelatedInterface(CacheObjectInterface val) {
+ relatedInterface = val;
+ }
+
+ public CacheObjectInterface getRelatedInterface() {
+ return relatedInterface;
+ }
+
+ public String toString() {
+ try {
+ return "CacheObjectA: " + super.toString() + "; name: " + name
+ + "; age: " + age;
+ }
+ catch (Exception e) {
+ return "CacheObjectA: " + super.toString() + "; "
+ + "Exception in toString(): " + e;
+ }
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectAChild1.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectAChild1.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectAChild1.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectAChild1.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,48 @@
+/*
+ * 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.common.apps;
+
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+
+/**
+ * Used in testing; should be enhanced.
+ */
+@Entity
+@DiscriminatorValue("CACHE_CHILD1")
+public class CacheObjectAChild1 extends CacheObjectA {
+
+ private String str1 = null;
+
+ protected CacheObjectAChild1() {
+ }
+
+ public CacheObjectAChild1(String s, String name, int age) {
+ super(name, age);
+ this.str1 = s;
+ }
+
+ public String getStr1() {
+ return str1;
+ }
+
+ public void setStr1(String s) {
+ this.str1 = s;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectAChild2.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectAChild2.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectAChild2.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectAChild2.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,48 @@
+/*
+ * 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.common.apps;
+
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+
+import org.apache.openjpa.persistence.DataCache;
+
+@Entity
+@DiscriminatorValue("CACHE_CHILD2")
+@DataCache(enabled = false)
+public class CacheObjectAChild2 extends CacheObjectA {
+
+ private String str2 = null;
+
+ protected CacheObjectAChild2() {
+ }
+
+ public CacheObjectAChild2(String s, String name, int age) {
+ super(name, age);
+ this.str2 = s;
+ }
+
+ public String getStr2() {
+ return str2;
+ }
+
+ public void setStr2(String s) {
+ this.str2 = s;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectB.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectB.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectB.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectB.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,53 @@
+/*
+ * 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.common.apps;
+
+import javax.persistence.DiscriminatorColumn;
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+
+import org.apache.openjpa.persistence.DataCache;
+
+/**
+ * Used in testing; should be enhanced.
+ */
+@Entity
+@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
+@DiscriminatorColumn(name = "TYP")
+@DataCache(enabled = false)
+public class CacheObjectB {
+
+ private String str = null;
+
+ public CacheObjectB() {
+ }
+
+ public CacheObjectB(String s) {
+ this.str = s;
+ }
+
+ public String getStr() {
+ return str;
+ }
+
+ public void setStr(String s) {
+ this.str = s;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectBChild1.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectBChild1.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectBChild1.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectBChild1.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,44 @@
+/*
+ * 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.common.apps;
+
+import javax.persistence.Entity;
+
+@Entity
+public class CacheObjectBChild1
+ extends CacheObjectB {
+
+ private String str1 = null;
+
+ protected CacheObjectBChild1() {
+ }
+
+ public CacheObjectBChild1(String s, String name) {
+ super(name);
+ this.str1 = s;
+ }
+
+ public String getStr1() {
+ return str1;
+ }
+
+ public void setStr1(String s) {
+ this.str1 = s;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectC.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectC.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectC.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectC.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,54 @@
+/*
+ * 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.common.apps;
+
+import javax.persistence.DiscriminatorColumn;
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+
+import org.apache.openjpa.persistence.DataCache;
+
+/**
+ * Used in testing; should be enhanced.
+ */
+@Entity
+@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
+@DiscriminatorColumn(name = "TYP")
+@DataCache(name = "not-the-default-cache")
+public class CacheObjectC
+ implements CacheObjectInterface {
+
+ private String str = null;
+
+ public CacheObjectC() {
+ }
+
+ public CacheObjectC(String s) {
+ this.str = s;
+ }
+
+ public String getStr() {
+ return str;
+ }
+
+ public void setStr(String s) {
+ this.str = s;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectD.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectD.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectD.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectD.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,53 @@
+/*
+ * 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.common.apps;
+
+import javax.persistence.DiscriminatorColumn;
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+
+import org.apache.openjpa.persistence.DataCache;
+
+/**
+ * Used in testing; should be enhanced.
+ */
+@Entity
+@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
+@DiscriminatorColumn(name = "TYP")
+@DataCache(name = "not-the-default-cache")
+public class CacheObjectD {
+
+ private String str = null;
+
+ public CacheObjectD() {
+ }
+
+ public CacheObjectD(String s) {
+ this.str = s;
+ }
+
+ public String getStr() {
+ return str;
+ }
+
+ public void setStr(String s) {
+ this.str = s;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectE.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectE.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectE.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectE.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,50 @@
+/*
+ * 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.common.apps;
+
+import javax.persistence.DiscriminatorColumn;
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+
+/**
+ * Used in testing; should be enhanced.
+ */
+@Entity
+@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
+@DiscriminatorColumn(name = "TYP")
+public class CacheObjectE {
+
+ private String str = null;
+
+ public CacheObjectE() {
+ }
+
+ public CacheObjectE(String s) {
+ this.str = s;
+ }
+
+ public String getStr() {
+ return str;
+ }
+
+ public void setStr(String s) {
+ this.str = s;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectF.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectF.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectF.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectF.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,39 @@
+/*
+ * 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.common.apps;
+
+import javax.persistence.Entity;
+
+import org.apache.openjpa.persistence.DataCache;
+
+/**
+ * Used in testing; should be enhanced.
+ */
+@Entity
+@DataCache(timeout = 1000)
+public class CacheObjectF
+ extends CacheObjectE {
+
+ public CacheObjectF() {
+ }
+
+ public CacheObjectF(String s) {
+ super(s);
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectG.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectG.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectG.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectG.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,39 @@
+/*
+ * 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.common.apps;
+
+import javax.persistence.Entity;
+
+import org.apache.openjpa.persistence.DataCache;
+
+/**
+ * Used in testing; should be enhanced.
+ */
+@Entity
+@DataCache(timeout = 5000)
+public class CacheObjectG
+ extends CacheObjectF {
+
+ public CacheObjectG() {
+ }
+
+ public CacheObjectG(String s) {
+ super(s);
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectH.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectH.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectH.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectH.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,39 @@
+/*
+ * 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.common.apps;
+
+import javax.persistence.Entity;
+
+import org.apache.openjpa.persistence.DataCache;
+
+/**
+ * Used in testing; should be enhanced.
+ */
+@Entity
+@DataCache(timeout = 500)
+public class CacheObjectH
+ extends CacheObjectG {
+
+ public CacheObjectH() {
+ }
+
+ public CacheObjectH(String s) {
+ super(s);
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectInterface.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectInterface.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectInterface.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectInterface.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,26 @@
+/*
+ * 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.common.apps;
+
+public interface CacheObjectInterface {
+
+ public void setStr(String val);
+
+ public String getStr();
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectJ.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectJ.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectJ.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectJ.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,60 @@
+/*
+ * 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.common.apps;
+
+import javax.persistence.CascadeType;
+import javax.persistence.DiscriminatorColumn;
+import javax.persistence.Entity;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.ManyToOne;
+
+/**
+ * Used in testing; should be enhanced.
+ */
+@Entity
+@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
+@DiscriminatorColumn(name = "TYP")
+public class CacheObjectJ {
+
+ private String str = null;
+ @ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
+ private CacheObjectE e = null;
+
+ public CacheObjectJ() {
+ }
+
+ public CacheObjectJ(String s, CacheObjectE e) {
+ this.str = s;
+ this.e = e;
+ }
+
+ public String getStr() {
+ return str;
+ }
+
+ public void setStr(String s) {
+ this.str = s;
+ }
+
+ //@Embedded()
+ public CacheObjectE getE() {
+ return e;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectWithExternalizedFields.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectWithExternalizedFields.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectWithExternalizedFields.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/CacheObjectWithExternalizedFields.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,39 @@
+/*
+ * 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.common.apps;
+
+import javax.persistence.Entity;
+
+@Entity
+/**
+ * A test class for our caching framework that ensures that externalized
+ * fields are handled properly.
+ */
+public class CacheObjectWithExternalizedFields {
+
+ private Class cls;
+
+ public void setCls(Class cls) {
+ this.cls = cls;
+ }
+
+ public Class getCls() {
+ return this.cls;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/FlushDataCacheObject.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/FlushDataCacheObject.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/FlushDataCacheObject.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/FlushDataCacheObject.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,35 @@
+/*
+ * 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.common.apps;
+
+import javax.persistence.Entity;
+
+@Entity
+public class FlushDataCacheObject {
+
+ private String string;
+
+ public void setString(String val) {
+ string = val;
+ }
+
+ public String getString() {
+ return string;
+ }
+}
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/RuntimeTest1.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/RuntimeTest1.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/RuntimeTest1.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/RuntimeTest1.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,284 @@
+/*
+ * 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.common.apps;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Set;
+import javax.persistence.CascadeType;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.OneToMany;
+import javax.persistence.OneToOne;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+/**
+ * Used in testing; should be enhanced.
+ */
+@Entity
+@DiscriminatorValue("dataRt1")
+public class RuntimeTest1
+ implements Serializable {
+
+ public static final String someStaticField = "someField";
+
+ private byte byteField;
+ private boolean booleanField;
+ private char charField;
+ private double doubleField;
+ private float floatField;
+ private int intField;
+ private long longField;
+ private short shortField;
+ private String stringField;
+ private BigInteger bigIntegerField;
+ private BigDecimal bigDecimalField;
+ @Temporal(TemporalType.DATE)
+ private Date dateField;
+ private Locale localeField;
+ private Byte byteObjfield;
+ private Boolean booleanObjField;
+ private Character charObjField;
+ private Double doubleObjField;
+ private Float floatObjField;
+ private Integer intObjField;
+ private Long longObjField;
+ private Short shortObjField;
+
+ // transactional only
+ @OneToOne(fetch = FetchType.LAZY,
+ cascade = { CascadeType.PERSIST, CascadeType.REMOVE })
+ private TransactionalClassPC transField;
+ public String transString;
+
+ // relations
+ @OneToOne(fetch = FetchType.LAZY,
+ cascade = { CascadeType.PERSIST, CascadeType.REMOVE })
+ private RuntimeTest1 selfOneOne;
+
+ @OneToMany(mappedBy = "selfOneOne",
+ cascade = { CascadeType.PERSIST, CascadeType.REMOVE })
+ private Set<RuntimeTest1> selfOneMany = new HashSet<RuntimeTest1>();
+
+ public RuntimeTest1() {
+ }
+
+ public RuntimeTest1(String str, int i) {
+ stringField = str;
+ intField = i;
+ }
+
+ public byte getByteField() {
+ return this.byteField;
+ }
+
+ public void setByteField(byte byteField) {
+ this.byteField = byteField;
+ }
+
+ public boolean getBooleanField() {
+ return this.booleanField;
+ }
+
+ public void setBooleanField(boolean booleanField) {
+ this.booleanField = booleanField;
+ }
+
+ public char getCharField() {
+ return this.charField;
+ }
+
+ public void setCharField(char charField) {
+ this.charField = charField;
+ }
+
+ public double getDoubleField() {
+ return this.doubleField;
+ }
+
+ public void setDoubleField(double doubleField) {
+ this.doubleField = doubleField;
+ }
+
+ public float getFloatField() {
+ return this.floatField;
+ }
+
+ public void setFloatField(float floatField) {
+ this.floatField = floatField;
+ }
+
+ public int getIntField() {
+ return this.intField;
+ }
+
+ public void setIntField(int intField) {
+ this.intField = intField;
+ }
+
+ public long getLongField() {
+ return this.longField;
+ }
+
+ public void setLongField(long longField) {
+ this.longField = longField;
+ }
+
+ public short getShortField() {
+ return this.shortField;
+ }
+
+ public void setShortField(short shortField) {
+ this.shortField = shortField;
+ }
+
+ public String getStringField() {
+ return this.stringField;
+ }
+
+ public void setStringField(String stringField) {
+ this.stringField = stringField;
+ }
+
+ public BigInteger getBigIntegerField() {
+ return this.bigIntegerField;
+ }
+
+ public void setBigIntegerField(BigInteger bigIntegerField) {
+ this.bigIntegerField = bigIntegerField;
+ }
+
+ public BigDecimal getBigDecimalField() {
+ return this.bigDecimalField;
+ }
+
+ public void setBigDecimalField(BigDecimal bigDecimalField) {
+ this.bigDecimalField = bigDecimalField;
+ }
+
+ public Date getDateField() {
+ return this.dateField;
+ }
+
+ public void setDateField(Date dateField) {
+ this.dateField = dateField;
+ }
+
+ public Locale getLocaleField() {
+ return this.localeField;
+ }
+
+ public void setLocaleField(Locale localeField) {
+ this.localeField = localeField;
+ }
+
+ public Byte getByteObjfield() {
+ return this.byteObjfield;
+ }
+
+ public void setByteObjfield(Byte byteObjfield) {
+ this.byteObjfield = byteObjfield;
+ }
+
+ public Boolean getBooleanObjField() {
+ return this.booleanObjField;
+ }
+
+ public void setBooleanObjField(Boolean booleanObjField) {
+ this.booleanObjField = booleanObjField;
+ }
+
+ public Character getCharObjField() {
+ return this.charObjField;
+ }
+
+ public void setCharObjField(Character charObjField) {
+ this.charObjField = charObjField;
+ }
+
+ public Double getDoubleObjField() {
+ return this.doubleObjField;
+ }
+
+ public void setDoubleObjField(Double doubleObjField) {
+ this.doubleObjField = doubleObjField;
+ }
+
+ public Float getFloatObjField() {
+ return this.floatObjField;
+ }
+
+ public void setFloatObjField(Float floatObjField) {
+ this.floatObjField = floatObjField;
+ }
+
+ public Integer getIntObjField() {
+ return this.intObjField;
+ }
+
+ public void setIntObjField(Integer intObjField) {
+ this.intObjField = intObjField;
+ }
+
+ public Long getLongObjField() {
+ return this.longObjField;
+ }
+
+ public void setLongObjField(Long longObjField) {
+ this.longObjField = longObjField;
+ }
+
+ public Short getShortObjField() {
+ return this.shortObjField;
+ }
+
+ public void setShortObjField(Short shortObjField) {
+ this.shortObjField = shortObjField;
+ }
+
+ public TransactionalClassPC getTransField() {
+ return this.transField;
+ }
+
+ public void setTransField(TransactionalClassPC transField) {
+ this.transField = transField;
+ }
+
+ public RuntimeTest1 getSelfOneOne() {
+ return this.selfOneOne;
+ }
+
+ public void setSelfOneOne(RuntimeTest1 selfOneOne) {
+ this.selfOneOne = selfOneOne;
+ }
+
+ public Set getSelfOneMany() {
+ return this.selfOneMany;
+ }
+
+ public void setSelfOneMany(Set selfOneMany) {
+ this.selfOneMany = selfOneMany;
+ }
+}