openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r627979 [10/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-per...
Date Fri, 15 Feb 2008 09:20:40 GMT
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/RuntimeTest2.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/RuntimeTest2.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/RuntimeTest2.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/RuntimeTest2.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.DiscriminatorValue;
+import javax.persistence.Entity;
+
+/**
+ * <p>Persitent type used in testing.</p>
+ *
+ * @author Abe White
+ */
+@Entity
+@DiscriminatorValue("dataRt2")
+public class RuntimeTest2
+    extends RuntimeTest1 {
+
+    private int intField2;
+
+    public RuntimeTest2() {
+    }
+
+    public RuntimeTest2(String str, int i) {
+        super(str, i);
+    }
+
+    public int getIntField2() {
+        return this.intField2;
+    }
+
+    public void setIntField2(int intField2) {
+        this.intField2 = intField2;
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/ScheduledEviction.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/ScheduledEviction.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/ScheduledEviction.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/ScheduledEviction.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 ScheduledEviction {
+
+    private String stringField;
+
+    public ScheduledEviction(String s) {
+        stringField = s;
+    }
+
+    public String getStringField() {
+        return stringField;
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/SelfReferencingCacheTestObject.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/SelfReferencingCacheTestObject.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/SelfReferencingCacheTestObject.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/SelfReferencingCacheTestObject.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,47 @@
+/*
+ * 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.Entity;
+import javax.persistence.ManyToOne;
+
+@Entity
+public class SelfReferencingCacheTestObject {
+
+    private String str;
+    @ManyToOne(cascade = { CascadeType.PERSIST, CascadeType.MERGE })
+    private SelfReferencingCacheTestObject o;
+    private CacheObjectAChild1 embedded;
+
+    public SelfReferencingCacheTestObject(String str,
+        SelfReferencingCacheTestObject o) {
+        this.str = str;
+        this.o = o;
+        embedded = new CacheObjectAChild1(str, str, 0);
+    }
+
+    public SelfReferencingCacheTestObject getO() {
+        return o;
+    }
+
+    public String getStr() {
+        return str;
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/TransactionalClassPC.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/TransactionalClassPC.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/TransactionalClassPC.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/common/apps/TransactionalClassPC.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 TransactionalClassPC {
+
+    private int intField;
+
+    public int getIntField() {
+        return this.intField;
+    }
+
+    public void setIntField(int intField) {
+        this.intField = intField;
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/TestClone.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/TestClone.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/TestClone.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/TestClone.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,98 @@
+/*
+ * 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.enhance;
+
+
+import org.apache.openjpa.persistence.enhance.common.apps.NoClone;
+import org.apache.openjpa.persistence.enhance.common.apps.PCClone;
+import org.apache.openjpa.persistence.enhance.common.apps.SubclassClone;
+import org.apache.openjpa.persistence.common.utils.AbstractTestCase;
+import org.apache.openjpa.persistence.OpenJPAEntityManager;
+
+public class TestClone
+    extends AbstractTestCase {
+
+    public TestClone(String name) {
+        super(name, "enhancecactusapp");
+    }
+
+    public void setUp() {
+
+        deleteAll(NoClone.class);
+        deleteAll(PCClone.class);
+        deleteAll(SubclassClone.class);
+    }
+
+    /**
+     * test no clone method declared.
+     */
+    public void testNoClone() {
+        OpenJPAEntityManager pm =
+            (OpenJPAEntityManager) currentEntityManager();
+        startTx(pm);
+        NoClone orig = new NoClone("test");
+        pm.persist(orig);
+        endTx(pm);
+        pm.refresh(orig);
+        NoClone copy = orig.safeClone();
+        assertEquals("test", copy.getString());
+        assertTrue(pm.isPersistent(orig));
+        assertFalse(pm.isPersistent(copy));
+        endEm(pm);
+    }
+
+    /**
+     * test subclass which we cannot handle safely
+     */
+    public void testSubclassClone() {
+        OpenJPAEntityManager pm =
+            (OpenJPAEntityManager) currentEntityManager();
+        startTx(pm);
+        SubclassClone orig = new SubclassClone("test");
+        pm.persist(orig);
+        endTx(pm);
+        pm.refresh(orig);
+        SubclassClone copy = orig.safeClone();
+        assertEquals("test", copy.getString());
+        assertTrue(pm.isPersistent(orig));
+        // this should be true since the sm should be VM copied.
+        // as we intentionally don't handle this case.
+        assertTrue(pm.isPersistent(copy));
+        endEm(pm);
+    }
+
+    /**
+     * test explicit clone call
+     */
+    public void testPCClone() {
+        OpenJPAEntityManager pm =
+            (OpenJPAEntityManager) currentEntityManager();
+        startTx(pm);
+        PCClone orig = new PCClone("test");
+        pm.persist(orig);
+        endTx(pm);
+        pm.refresh(orig);
+        PCClone copy = (PCClone) orig.clone();
+        assertEquals("test", copy.getString());
+        assertTrue(pm.isPersistent(orig));
+        assertFalse(pm.isPersistent(copy));
+        endEm(pm);
+    }
+}
+

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/TestDynamicStorageGenerator.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/TestDynamicStorageGenerator.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/TestDynamicStorageGenerator.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/TestDynamicStorageGenerator.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,79 @@
+/*
+ * 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.enhance;
+
+import java.util.Date;
+
+import org.apache.openjpa.persistence.common.utils.AbstractTestCase;
+import org.apache.openjpa.enhance.DynamicStorage;
+import org.apache.openjpa.enhance.DynamicStorageGenerator;
+import org.apache.openjpa.meta.JavaTypes;
+
+public class TestDynamicStorageGenerator
+    extends AbstractTestCase {
+
+    public TestDynamicStorageGenerator(String s) {
+        super(s, "enhancecactusapp");
+    }
+
+    public void testStorage()
+        throws Exception {
+
+        DynamicStorageGenerator gen = new DynamicStorageGenerator();
+        int[] types = new int[]{
+            JavaTypes.BOOLEAN,
+            JavaTypes.BYTE,
+            JavaTypes.CHAR,
+            JavaTypes.INT,
+            JavaTypes.SHORT,
+            JavaTypes.LONG,
+            JavaTypes.FLOAT,
+            JavaTypes.DOUBLE,
+            JavaTypes.STRING,
+            JavaTypes.OBJECT
+        };
+        DynamicStorage storage = gen.generateStorage(types,
+            "org.apache.openjpa.enhance.Test");
+        storage = storage.newInstance();
+
+        storage.setBoolean(0, true);
+        storage.setByte(1, (byte) 1);
+        storage.setChar(2, 'f');
+        storage.setInt(3, 3);
+        storage.setShort(4, (short) 4);
+        storage.setLong(5, 5);
+        storage.setFloat(6, (float) 6.6);
+        storage.setDouble(7, 7.7);
+        storage.setObject(8, "field8");
+        Date date = new Date();
+        storage.setObject(9, date);
+
+        assertTrue(storage.getBoolean(0));
+        assertEquals(1, storage.getByte(1));
+        assertEquals('f', storage.getChar(2));
+        assertEquals(3, storage.getInt(3));
+        assertEquals(4, storage.getShort(4));
+        assertEquals(5, storage.getLong(5));
+        assertTrue(6.59 < storage.getFloat(6) && 6.61 > storage.getFloat(6));
+        assertTrue(7.69 < storage.getDouble(7)
+            && 7.71 > storage.getDouble(7));
+        assertEquals("field8", storage.getObject(8));
+        assertEquals(date, storage.getObject(9));
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/TestNoNoArgs.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/TestNoNoArgs.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/TestNoNoArgs.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/TestNoNoArgs.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,78 @@
+/*
+ * 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.enhance;
+
+import java.io.IOException;
+
+import org.apache.openjpa.persistence.common.utils.AbstractTestCase;
+import org.apache.openjpa.conf.OpenJPAConfiguration;
+import org.apache.openjpa.enhance.PCEnhancer;
+import org.apache.openjpa.meta.MetaDataRepository;
+import org.apache.openjpa.persistence.OpenJPAEntityManager;
+import org.apache.openjpa.persistence.OpenJPAEntityManagerSPI;
+import org.apache.openjpa.util.OpenJPAException;
+
+public class TestNoNoArgs
+    extends AbstractTestCase {
+
+    OpenJPAConfiguration conf;
+    MetaDataRepository repos;
+    ClassLoader loader;
+    private PCEnhancer.Flags flags = new PCEnhancer.Flags();
+
+    public TestNoNoArgs(String s) {
+        super(s, "enhancecactusapp");
+    }
+
+    public void setUp() {
+        OpenJPAEntityManager em =
+            (OpenJPAEntityManager) currentEntityManager();
+        conf = ((OpenJPAEntityManagerSPI) em).getConfiguration();
+        repos = conf.newMetaDataRepositoryInstance();
+        loader = em.getClassLoader();
+        endEm(em);
+    }
+
+    public void testNoNoArgs()
+        throws IOException {
+        PCEnhancer.run((OpenJPAConfiguration) conf,
+            new String[]{ },
+            flags, repos, null, loader);
+    }
+
+    public void testNo2NoArgs()
+        throws IOException {
+        flags.addDefaultConstructor = false;
+        boolean caughtException = false;
+        try {
+            PCEnhancer.run((OpenJPAConfiguration) conf, new String[]{ },
+                flags, repos, null, loader);
+        } catch (OpenJPAException e) {
+            caughtException = true;
+        }
+        assertTrue(caughtException);
+    }
+
+    public void testNo3NoArgs()
+        throws IOException {
+        PCEnhancer.run((OpenJPAConfiguration) conf,
+            new String[]{ "persistence.enhance.common.apps.Entity1" },
+            flags, repos, null, loader);
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/TestSubclassedBehavior.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/TestSubclassedBehavior.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/TestSubclassedBehavior.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/TestSubclassedBehavior.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,559 @@
+/*
+ * 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.enhance;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+
+
+import org.apache.openjpa.persistence.enhance.common.apps.BackingFieldNameMismatchInstance;
+import org.apache.openjpa.persistence.enhance.common.apps.BaseEntity;
+import org.apache.openjpa.persistence.enhance.common.apps.BasicSubclassInstance;
+import org.apache.openjpa.persistence.enhance.common.apps.DerivedEntity;
+import org.apache.openjpa.persistence.enhance.common.apps.Entity1;
+import org.apache.openjpa.persistence.enhance.common.apps.ManagedInverseTestInstance;
+import org.apache.openjpa.persistence.enhance.common.apps.ManagedInverseTestInstance2;
+import org.apache.openjpa.persistence.enhance.common.apps.SubclassTestInstance;
+import org.apache.openjpa.persistence.common.utils.AbstractTestCase;
+import junit.framework.AssertionFailedError;
+import org.apache.openjpa.kernel.Broker;
+import org.apache.openjpa.kernel.OpenJPAStateManager;
+import org.apache.openjpa.meta.ClassMetaData;
+import org.apache.openjpa.meta.FieldMetaData;
+import org.apache.openjpa.persistence.JPAFacadeHelper;
+import org.apache.openjpa.persistence.OpenJPAEntityManager;
+import org.apache.openjpa.persistence.OpenJPAQuery;
+import org.apache.openjpa.util.ExceptionInfo;
+import org.apache.openjpa.util.ImplHelper;
+
+public class TestSubclassedBehavior extends AbstractTestCase {
+
+    public TestSubclassedBehavior(String name) {
+        super(name, "enhancecactusapp");
+    }
+
+
+    public void setUp() {
+        deleteAll(BasicSubclassInstance.class);
+        deleteAll(BackingFieldNameMismatchInstance.class);
+        deleteAll(BaseEntity.class);
+        deleteAll(ManagedInverseTestInstance.class);
+        deleteAll(ManagedInverseTestInstance2.class);
+    }
+
+    public void testInheritance() {
+        OpenJPAEntityManager pm =
+            (OpenJPAEntityManager) currentEntityManager();
+        DerivedEntity de = (DerivedEntity) newInstance(pm, DerivedEntity.class);
+        BasicSubclassInstance basic = (BasicSubclassInstance) newInstance(pm,
+            BasicSubclassInstance.class);
+        basic.setStringField("basic one-to-one");
+        de.setOneToOne(basic);
+        Object oid = persistenceOperations(pm, de, false);
+
+        // ##### need a test case for JDOHelper.createEntityManager() for
+        // subclass
+        ClassMetaData meta = JPAFacadeHelper.getMetaData(pm, de.getClass());
+        assertEquals(BaseEntity.class, meta.getPCSuperclass());
+
+        pm = (OpenJPAEntityManager) currentEntityManager();
+
+        Object o = pm.find(DerivedEntity.class, oid);
+        assertTrue(o instanceof DerivedEntity);
+        de = (DerivedEntity) o;
+        Broker b = JPAFacadeHelper.toBroker(pm);
+        OpenJPAStateManager sm = b.getStateManager(de);
+        // we use getLoaded() here because isLoaded() always returns true.
+        assertFalse(sm.getLoaded().get(
+            sm.getMetaData().getField("oneToOne").getIndex()));
+        assertEquals("basic one-to-one", de.getOneToOne().getStringField());
+        assertTrue(sm.getLoaded().get(sm.getMetaData()
+            .getField("oneToOne").getIndex()));
+
+        startTx(pm);
+        pm.remove(de);
+        endTx(pm);
+        endEm(pm);
+    }
+
+    public void testBasicSubclassPersistenceOperations()
+        throws ClassNotFoundException {
+        OpenJPAEntityManager pm =
+            (OpenJPAEntityManager) currentEntityManager();
+        BasicSubclassInstance o = (BasicSubclassInstance) newInstance(pm,
+            BasicSubclassInstance.class);
+        persistenceOperations(pm, o, true);
+    }
+
+    public void testBackingFieldNameMismatch() {
+        OpenJPAEntityManager pm =
+            (OpenJPAEntityManager) currentEntityManager();
+        BackingFieldNameMismatchInstance o = (BackingFieldNameMismatchInstance)
+            newInstance(pm, BackingFieldNameMismatchInstance.class);
+        persistenceOperations(pm, o, true);
+    }
+
+    private Object newInstance(OpenJPAEntityManager pm, Class cls) {
+        return pm.createInstance(cls);
+    }
+
+    private Object createInstance(EntityManager em, Class cls) {
+        return ((OpenJPAEntityManager) em).createInstance(cls);
+    }
+
+    private Object persistenceOperations(OpenJPAEntityManager pm,
+        SubclassTestInstance o, boolean delete) {
+        startTx(pm);
+        pm.persist(o);
+        o.setStringField("new persistent instance");
+        endTx(pm);
+        Object oid = pm.getObjectId(o);
+        endEm(pm);
+
+        pm = (OpenJPAEntityManager) currentEntityManager();
+        o = (SubclassTestInstance) pm.find(SubclassTestInstance.class, oid);
+
+        assertEquals("new persistent instance", o.getStringField());
+        startTx(pm);
+        o.setStringField("modified persistent instance");
+        endTx(pm);
+        endEm(pm);
+
+        if (delete) {
+            pm = (OpenJPAEntityManager) currentEntityManager();
+            o = (SubclassTestInstance) pm.find(SubclassTestInstance.class, oid);
+            assertEquals("modified persistent instance", o.getStringField());
+            startTx(pm);
+            pm.remove(o);
+            endTx(pm);
+            endEm(pm);
+            return null;
+        } else {
+            return oid;
+        }
+    }
+
+    public void testPolymorphicQueries() {
+        deleteAll(BaseEntity.class);
+        deleteAll(BasicSubclassInstance.class);
+
+        OpenJPAEntityManager pm =
+            (OpenJPAEntityManager) currentEntityManager();
+        startTx(pm);
+
+        BaseEntity be = (BaseEntity) newInstance(pm, BaseEntity.class);
+        be.setShortField((short) 0);
+        pm.persist(be);
+
+        be = (BaseEntity) newInstance(pm, BaseEntity.class);
+        be.setShortField((short) 1);
+        pm.persist(be);
+
+        DerivedEntity de = (DerivedEntity) newInstance(pm, DerivedEntity.class);
+        de.setShortField((short) 2);
+        de.setOneToOne((BasicSubclassInstance) newInstance(pm,
+            BasicSubclassInstance.class));
+        pm.persist(de);
+
+        de = (DerivedEntity) newInstance(pm, DerivedEntity.class);
+        de.setShortField((short) 3);
+        de.setOneToOne((BasicSubclassInstance) newInstance(pm,
+            BasicSubclassInstance.class));
+        pm.persist(de);
+
+        endTx(pm);
+        endEm(pm);
+
+        pm = (OpenJPAEntityManager) currentEntityManager();
+        OpenJPAQuery q =
+            pm.createQuery("SELECT a FROM BaseEntity a "
+                + "ORDER BY a.shortField ASC");
+        List l = (List) q.getResultList();
+        assertEquals(4, l.size());
+        assertEquals(0, ((BaseEntity) l.get(0)).getShortField());
+        assertEquals(1, ((BaseEntity) l.get(1)).getShortField());
+        assertEquals(2, ((BaseEntity) l.get(2)).getShortField());
+        assertEquals(3, ((BaseEntity) l.get(3)).getShortField());
+        assertTrue(l.get(2) instanceof DerivedEntity);
+        assertTrue(l.get(3) instanceof DerivedEntity);
+        endEm(pm);
+    }
+
+    public void testEnhancedClassChangesOutsideTxWithoutNTW() {
+        OpenJPAEntityManager pm =
+            (OpenJPAEntityManager) currentEntityManager();
+        startTx(pm);
+        deleteAll(Entity1.class);
+        endTx(pm);
+        Entity1 o = new Entity1(8, "pk 8", 4);
+        startTx(pm);
+        pm.persist(o);
+        endTx(pm);
+        Object oid = pm.getObjectId(o);
+        endEm(pm);
+
+        pm = (OpenJPAEntityManager) currentEntityManager();
+        o = (Entity1) pm.find(Entity1.class, oid);
+
+        try {
+            o.setStringField("hello");
+            fail("non-transactional write should not be allowed");
+        } catch (Exception e) {
+            // expected
+        } finally {
+            endEm(pm);
+        }
+    }
+
+    public void testSubclassChangesOutsideTxWithoutNTW() {
+        OpenJPAEntityManager pm =
+            (OpenJPAEntityManager) currentEntityManager();
+        BasicSubclassInstance basic = (BasicSubclassInstance) newInstance(pm,
+            BasicSubclassInstance.class);
+        basic.setStringField("foo");
+        startTx(pm);
+        pm.persist(basic);
+        endTx(pm);
+        Object oid = pm.getObjectId(basic);
+        endEm(pm);
+
+        pm = (OpenJPAEntityManager) currentEntityManager();
+        basic =
+            (BasicSubclassInstance) pm.find(BasicSubclassInstance.class, oid);
+
+        try {
+            basic.setStringField("hello");
+            fail("non-transactional write should not be allowed");
+        } catch (Exception e) {
+            // expected
+        } finally {
+            endEm(pm);
+        }
+    }
+
+    public void testBasicPMUses() {
+        // retain so we don't reload in the reads after the tx commit
+        OpenJPAEntityManager pm =
+            (OpenJPAEntityManager) currentEntityManager();
+        Broker broker = JPAFacadeHelper.toBroker(pm);
+        startTx(pm);
+
+        // register a new instance with the PM
+        BasicSubclassInstance basic = (BasicSubclassInstance) newInstance
+            (pm, BasicSubclassInstance.class);
+        assertTrue(ImplHelper.isManageable(basic));
+        basic.setStringField("foo");
+        pm.persist(basic);
+        assertTrue(broker.isNew(basic));
+        assertTrue(broker.isPersistent(basic));
+
+        // commit. this should cause the data to be written.
+        // ### should check SQL count
+        endTx(pm);
+
+        assertFalse(broker.isNew(basic));
+
+        OpenJPAStateManager sm = broker.getStateManager(basic);
+        assertNotNull(sm);
+        assertEquals(sm.getManagedInstance(), basic);
+
+        FieldMetaData fmd = sm.getMetaData().getField("stringField");
+        assertEquals("foo", sm.fetch(fmd.getIndex()));
+        assertTrue(sm.getLoaded().get(fmd.getIndex()));
+
+        pm.evict(basic);
+        assertFalse(sm.getLoaded().get(fmd.getIndex()));
+        // lazy loading
+        assertNotNull(basic.getStringField());
+        assertEquals("foo", sm.fetch(fmd.getIndex()));
+        assertEquals("foo", basic.getStringField());
+        assertTrue(sm.getLoaded().get(fmd.getIndex()));
+
+        startTx(pm);
+        basic.setStringField("bar");
+        assertTrue(broker.isDirty(basic));
+        endTx(pm);
+        Object oid = broker.getObjectId(basic);
+        assertNotNull(oid);
+        endEm(pm);
+
+        pm = (OpenJPAEntityManager) currentEntityManager();
+        basic =
+            (BasicSubclassInstance) pm.find(BasicSubclassInstance.class, oid);
+        assertEquals("bar", basic.getStringField());
+
+        startTx(pm);
+        pm.remove(basic);
+        assertTrue(JPAFacadeHelper.toBroker(pm).isDeleted(basic));
+        endTx(pm);
+        endEm(pm);
+    }
+
+    public void testGetObjectId() {
+        OpenJPAEntityManager pm =
+            (OpenJPAEntityManager) currentEntityManager();
+        BasicSubclassInstance basic = new BasicSubclassInstance();
+        basic.setStringField("foo");
+        startTx(pm);
+        pm.persist(basic);
+        endTx(pm);
+        Object oid = null;
+        try {
+            assertNotNull(oid = pm.getObjectId(basic));
+        } catch (Exception e) {
+            fail("object id lookup failed: " + e.getMessage());
+        }
+
+        startTx(pm);
+        pm.remove(basic);
+        // before committing, id should exist still
+        assertNotNull(pm.getObjectId(basic));
+
+        endTx(pm);
+        assertNull(pm.getObjectId(basic));
+        endEm(pm);
+
+        // looking up the instance by id in a new PM should fail.
+        pm = (OpenJPAEntityManager) currentEntityManager();
+        try {
+            pm.find(BasicSubclassInstance.class, oid);
+            fail("instance should have been deleted!");
+        } catch (Exception e) {
+            // expected
+        }
+        endEm(pm);
+    }
+
+    public void testChangesOutsideTxWithNTW() {
+        OpenJPAEntityManager pm =
+            (OpenJPAEntityManager) currentEntityManager();
+        BasicSubclassInstance basic = new BasicSubclassInstance();
+        basic.setStringField("foo");
+        startTx(pm);
+        pm.persist(basic);
+        endTx(pm);
+        Object oid = pm.getObjectId(basic);
+        endEm(pm);
+
+        pm = getNTWPM();
+        basic =
+            (BasicSubclassInstance) pm.find(BasicSubclassInstance.class, oid);
+        basic.setStringField("hello");
+        startTx(pm);
+        endTx(pm);
+        endEm(pm);
+
+        pm = (OpenJPAEntityManager) currentEntityManager();
+        basic =
+            (BasicSubclassInstance) pm.find(BasicSubclassInstance.class, oid);
+        try {
+            assertEquals("hello", basic.getStringField());
+        } catch (AssertionFailedError afe) {
+            bug(1205, afe, "JDO 2-style NTW not supported.");
+        }
+    }
+
+    public void testChangesOutsideTxWithoutNTW() {
+        OpenJPAEntityManager pm =
+            (OpenJPAEntityManager) currentEntityManager();
+        BasicSubclassInstance basic = new BasicSubclassInstance();
+        basic.setStringField("foo");
+        startTx(pm);
+        pm.persist(basic);
+        endTx(pm);
+
+        try {
+            basic.setStringField("hello");
+            fail("should not be able to write outside tx without NTW");
+        } catch (RuntimeException re) {
+            // expected case
+            Object failed = ((ExceptionInfo) re).getFailedObject();
+            assertNotNull(failed);
+            assertSame(basic, failed);
+        } finally {
+            endEm(pm);
+        }
+    }
+
+    private OpenJPAEntityManager getNTWPM() {
+        EntityManagerFactory pmf = getEmf();
+        OpenJPAEntityManager em =
+            (OpenJPAEntityManager) pmf.createEntityManager();
+        em.setNontransactionalWrite(true);
+        return em;
+    }
+
+    /*
+     public void testCallbacks ()
+     {
+         fail ("##### unimplemented test");
+     }
+
+
+     public void testTransactionListeners ()
+     {
+         fail ("#####");
+     }
+
+
+     public void testRemoteCommitListeners ()
+     {
+         fail ("#####");
+     }
+
+
+     public void testCaching ()
+     {
+         fail ("#####");
+     }
+
+
+     public void testRemote ()
+     {
+         fail ("#####");
+     }
+     */
+
+    public void testVersionIncrementAndIdField() {
+        // make sure that version increments happen correctly, and are
+        // visible in the user-visible instance.
+        OpenJPAEntityManager pm =
+            (OpenJPAEntityManager) currentEntityManager();
+        BasicSubclassInstance basic = new BasicSubclassInstance();
+        basic.setStringField("foo");
+        startTx(pm);
+        pm.persist(basic);
+        endTx(pm);
+
+        assertEquals(1, basic.getVersion());
+        long id = basic.getId();
+        assertNotEquals(0, id);
+
+        startTx(pm);
+        basic.setStringField("bar");
+        endTx(pm);
+        assertEquals(2, basic.getVersion());
+        endEm(pm);
+    }
+
+    /*
+     public void testAutoAssignedFields ()
+     {
+         // make sure that auto-assigned field values get into the user-visible
+         // instance.
+         fail ("#####");
+     }
+     */
+
+    public void testJPABasics() {
+        EntityManager em = currentEntityManager();
+        BasicSubclassInstance basic = (BasicSubclassInstance) createInstance(
+            em, BasicSubclassInstance.class);
+        basic.setStringField("hello");
+        startTx(em);
+        em.persist(basic);
+        endTx(em);
+        endEm(em);
+    }
+
+    /*
+     public void testDetachmentAndAttachemnt ()
+     {
+         fail ("#####");
+     }
+
+
+     public void testEmbeddedNonEnhanced ()
+     {
+         fail ("#####");
+     }
+
+
+     public void testTransactionalNonEnhanced ()
+     {
+         fail ("#####");
+     }
+
+
+     public void testBulkTransactionalNonEnhanced ()
+     {
+         fail ("#####");
+     }
+     */
+
+    public void testSingleValuedInverseManagement() {
+        Map map = new HashMap();
+        map.put("openjpa.InverseManager", "true");
+        OpenJPAEntityManager pm = (OpenJPAEntityManager)
+            getEmf(map).createEntityManager();
+        ManagedInverseTestInstance managed = (ManagedInverseTestInstance)
+            newInstance(pm, ManagedInverseTestInstance.class);
+        ManagedInverseTestInstance2 managed2 = (ManagedInverseTestInstance2)
+            newInstance(pm, ManagedInverseTestInstance2.class);
+        managed.setStringField("managed");
+        managed2.setStringField("managed2");
+        managed.setManaged2(managed2);
+
+        startTx(pm);
+        pm.persist(managed);
+        endTx(pm);
+
+        assertSame(managed, managed2.getManaged());
+    }
+
+    public void testBackingFieldConfigurationWithTwoFactories() {
+        OpenJPAEntityManager pm =
+            (OpenJPAEntityManager) currentEntityManager();
+        // this causes DerivedEntity.class to get loaded into PCRegistry
+        newInstance(pm, DerivedEntity.class);
+        Map map = new HashMap();
+        map.put("openjpa.Log", "DiagnosticContext=subclass-two-factories-test");
+        pm = (OpenJPAEntityManager) getEmf(map).createEntityManager();
+        newInstance(pm, DerivedEntity.class);
+
+        // this second new-instance creation will result in the metadata
+        // defaults being loaded from the PCRegistry instead of via reflection.
+        // Make sure that things still work as expected from the
+        // registry-parsing code.
+        ClassMetaData meta = getConfiguration()
+            .getMetaDataRepositoryInstance().
+            getMetaData(DerivedEntity.class, null, false);
+        assertTrue("meta's access should be ACCESS_PROPERTY",
+            meta.getAccessType() == ClassMetaData.ACCESS_PROPERTY);
+        FieldMetaData[] fmds = meta.getFields();
+        for (int i = 0; i < fmds.length; i++) {
+            assertEquals(Method.class, fmds[i].getBackingMember().getClass());
+
+            // make sure that the fields are defined in the right part of the
+            // hierarchy
+            if (fmds[i].getName().equals("intField") ||
+                fmds[i].getName().equals("oneToOne")) {
+                assertEquals(DerivedEntity.class,
+                    fmds[i].getDefiningMetaData().getDescribedType());
+            } else {
+                assertEquals(BaseEntity.class,
+                    fmds[i].getDefiningMetaData().getDescribedType());
+            }
+        }
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/BackingFieldNameMismatchInstance.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/BackingFieldNameMismatchInstance.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/BackingFieldNameMismatchInstance.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/BackingFieldNameMismatchInstance.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,68 @@
+/*
+ * 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.enhance.common.apps;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Version;
+
+/**
+ * Backing field names do not match up with the property accessor names, and
+ * we use package-protected method access (which is not supported by JPA),
+ *
+ * @see TestPCSubclasser
+ */
+@Entity
+@Table(name = "BACKINGMISMATCH")
+public class BackingFieldNameMismatchInstance
+    implements SubclassTestInstance {
+
+    protected long _id; // protected since we don't have a setter
+    private int _version;
+    private String _s;
+
+    @Id
+    @GeneratedValue
+    public long getId() {
+        return _id;
+    }
+
+    public void setId(long id) {
+        _id = id;
+    }
+
+    @Version
+    public int getVersion() {
+        return _version;
+    }
+
+    public void setVersion(int v) {
+        _version = v;
+    }
+
+    public String getStringField() {
+        return _s;
+    }
+
+    public void setStringField(String s) {
+        _s = s;
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/BaseEntity.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/BaseEntity.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/BaseEntity.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/BaseEntity.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,75 @@
+/*
+ * 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.enhance.common.apps;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.Version;
+
+/**
+ * @see TestPCSubclasser
+ */
+@Entity
+@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
+public class BaseEntity
+    implements SubclassTestInstance {
+
+    private long _id;
+    private int _version;
+    private String _s;
+    private short _short;
+
+    @Id
+    @GeneratedValue
+    public long getId() {
+        return _id;
+    }
+
+    public void setId(long id) {
+        _id = id;
+    }
+
+    @Version
+    public int getVersion() {
+        return _version;
+    }
+
+    public void setVersion(int version) {
+        _version = version;
+    }
+
+    public void setStringField(String s) {
+        _s = s;
+    }
+
+    public String getStringField() {
+        return _s;
+    }
+
+    public short getShortField() {
+        return _short;
+    }
+
+    public void setShortField(short aShort) {
+        _short = aShort;
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/BasicSubclassInstance.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/BasicSubclassInstance.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/BasicSubclassInstance.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/BasicSubclassInstance.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,63 @@
+/*
+ * 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.enhance.common.apps;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Version;
+
+/**
+ * @see TestPCSubclasser
+ */
+@Entity
+public class BasicSubclassInstance
+    implements SubclassTestInstance {
+
+    private long id;
+    private int version;
+    private String stringField;
+
+    @Id
+    @GeneratedValue
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    @Version
+    public int getVersion() {
+        return version;
+    }
+
+    public void setVersion(int v) {
+        version = v;
+    }
+
+    public String getStringField() {
+        return stringField;
+    }
+
+    public void setStringField(String str) {
+        stringField = str;
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/DerivedEntity.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/DerivedEntity.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/DerivedEntity.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/DerivedEntity.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,56 @@
+/*
+ * 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.enhance.common.apps;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.OneToOne;
+
+/**
+ * @see TestPCSubclasser
+ */
+@Entity
+public class DerivedEntity
+    extends BaseEntity {
+
+    private int _i;
+    private BasicSubclassInstance _basic;
+
+    public int getIntField() {
+        return _i;
+    }
+
+    public void setIntField(int i) {
+        _i = i;
+    }
+
+    @OneToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
+    public BasicSubclassInstance getOneToOne() {
+        return _basic;
+    }
+
+    public void setOneToOne(BasicSubclassInstance basic) {
+        // ##### this should be throwing an exception, but clashes with
+        // delete behavior.
+        //#####if (basic == null)
+        //#####throw new NullPointerException ();
+        _basic = basic;
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/DetachablePC.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/DetachablePC.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/DetachablePC.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/DetachablePC.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,30 @@
+/*
+ * 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.enhance.common.apps;
+
+import java.io.Serializable;
+import javax.persistence.Entity;
+
+@Entity
+public class DetachablePC
+    implements Serializable {
+
+    private long id;
+    private String val;
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/DetachableVersionedPC.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/DetachableVersionedPC.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/DetachableVersionedPC.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/DetachableVersionedPC.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,31 @@
+/*
+ * 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.enhance.common.apps;
+
+import java.io.Serializable;
+import javax.persistence.Entity;
+
+@Entity
+public class DetachableVersionedPC
+    implements Serializable {
+
+    private long id;
+    private String val;
+    private int version;
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/Entity1.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/Entity1.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/Entity1.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/Entity1.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,101 @@
+/*
+ * 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.enhance.common.apps;
+
+import java.io.Serializable;
+import javax.persistence.Basic;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EntityResult;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.OneToOne;
+import javax.persistence.SqlResultSetMapping;
+import javax.persistence.Table;
+import javax.persistence.Version;
+
+@Entity
+@Table(name = "entity_1")
+@Inheritance(strategy = InheritanceType.JOINED)
+@SqlResultSetMapping(name = "NativeTestResult",
+    entities = @EntityResult(entityClass = Entity1.class))
+public class Entity1 implements Serializable {
+
+    private static final long serialVersionUID = 2882935803066041165L;
+
+    @Id
+    protected long pk;
+
+    @Basic
+    @Column(length = 35)
+    protected String stringField;
+
+    @Basic
+    protected int intField;
+
+    @OneToOne(cascade = { CascadeType.REMOVE, CascadeType.PERSIST })
+    protected Entity2 entity2Field;
+
+    @Version
+    protected int versionField;
+
+    public Entity1() {
+    }
+
+    public Entity1(long pk, String stringField, int intField) {
+        this.pk = pk;
+        this.stringField = stringField;
+        this.intField = intField;
+    }
+
+    public long getPk() {
+        return pk;
+    }
+
+    public void setStringField(String val) {
+        stringField = val;
+    }
+
+    public String getStringField() {
+        return stringField;
+    }
+
+    public void setIntField(int val) {
+        intField = val;
+    }
+
+    public int getIntField() {
+        return intField;
+    }
+
+    public void setEntity2Field(Entity2 val) {
+        entity2Field = val;
+    }
+
+    public Entity2 getEntity2Field() {
+        return entity2Field;
+    }
+
+    public String toString() {
+        return ("PK: " + pk + " StringField: " + stringField + " IntField: " +
+            intField);
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/Entity2.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/Entity2.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/Entity2.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/Entity2.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.enhance.common.apps;
+
+import java.io.Serializable;
+import javax.persistence.Basic;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+//@Entity(name="entity2ExplicitName")
+
+//@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
+/**
+ * FIX-ME
+ * <p/>
+ * It should complain if i uncomment the above strategies...but it does
+ */
+@Entity
+public class Entity2 implements Serializable {
+
+    /**
+     *
+     */
+    private static final long serialVersionUID = 4723739219953167343L;
+
+    @Id
+    protected long pk;
+
+    @Basic
+    @Column(length = 35)
+    protected String stringField;
+
+    @Basic
+    protected int intField;
+
+    public Entity2() {
+    }
+
+    public Entity2(long pk, String stringField, int intField) {
+        this.pk = pk;
+        this.stringField = stringField;
+        this.intField = intField;
+    }
+
+    public long getPk() {
+        return pk;
+    }
+
+    public void setStringField(String val) {
+        stringField = val;
+    }
+
+    public String getStringField() {
+        return stringField;
+    }
+
+    public void setIntField(int val) {
+        intField = val;
+    }
+
+    public int getIntField() {
+        return intField;
+    }
+
+    public String toString() {
+        return ("PK: " + pk + " StringField: " + stringField + " IntField: " +
+            intField);
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/ManagedInverseTestInstance.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/ManagedInverseTestInstance.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/ManagedInverseTestInstance.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/ManagedInverseTestInstance.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,73 @@
+/*
+ * 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.enhance.common.apps;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import javax.persistence.Version;
+
+@Entity
+@Table(name = "MGDINVERSE")
+public class ManagedInverseTestInstance {
+
+    private long id;
+    private int version;
+    private String stringField;
+    private ManagedInverseTestInstance2 managed2;
+
+    @Id
+    @GeneratedValue
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    @OneToOne(cascade = CascadeType.PERSIST)
+    public ManagedInverseTestInstance2 getManaged2() {
+        return managed2;
+    }
+
+    public void setManaged2(ManagedInverseTestInstance2 managed2) {
+        this.managed2 = managed2;
+    }
+
+    public String getStringField() {
+        return stringField;
+    }
+
+    public void setStringField(String stringField) {
+        this.stringField = stringField;
+    }
+
+    @Version
+    public int getVersion() {
+        return version;
+    }
+
+    public void setVersion(int version) {
+        this.version = version;
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/ManagedInverseTestInstance2.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/ManagedInverseTestInstance2.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/ManagedInverseTestInstance2.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/ManagedInverseTestInstance2.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,73 @@
+/*
+ * 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.enhance.common.apps;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.OneToOne;
+import javax.persistence.Table;
+import javax.persistence.Version;
+
+@Entity
+@Table(name = "MGDINVERSE_2")
+public class ManagedInverseTestInstance2 {
+
+    private long id;
+    private int version;
+    private String stringField;
+    private ManagedInverseTestInstance managed;
+
+    @Id
+    @GeneratedValue
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    @OneToOne(cascade = CascadeType.PERSIST, mappedBy = "managed2")
+    public ManagedInverseTestInstance getManaged() {
+        return managed;
+    }
+
+    public void setManaged(ManagedInverseTestInstance managed) {
+        this.managed = managed;
+    }
+
+    public String getStringField() {
+        return stringField;
+    }
+
+    public void setStringField(String stringField) {
+        this.stringField = stringField;
+    }
+
+    @Version
+    public int getVersion() {
+        return version;
+    }
+
+    public void setVersion(int version) {
+        this.version = version;
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/No2NoArgs.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/No2NoArgs.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/No2NoArgs.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/No2NoArgs.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,31 @@
+/*
+ * 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.enhance.common.apps;
+
+import javax.persistence.Entity;
+
+@Entity
+public class No2NoArgs {
+
+    private String name;
+
+    public No2NoArgs(String n) {
+        name = n;
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/No3NoArgs.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/No3NoArgs.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/No3NoArgs.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/No3NoArgs.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,31 @@
+/*
+ * 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.enhance.common.apps;
+
+import javax.persistence.Entity;
+
+@Entity
+public final class No3NoArgs {
+
+    private String name;
+
+    public No3NoArgs(String n) {
+        name = n;
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/NoClone.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/NoClone.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/NoClone.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/NoClone.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,43 @@
+/*
+ * 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.enhance.common.apps;
+
+import javax.persistence.Entity;
+
+@Entity
+public class NoClone implements Cloneable {
+
+    private String string;
+
+    public NoClone(String str) {
+        this.string = str;
+    }
+
+    public String getString() {
+        return string;
+    }
+
+    public NoClone safeClone() {
+        try {
+            return (NoClone) clone();
+        } catch (CloneNotSupportedException cnfe) {
+            return null;
+        }
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/NoNoArgs.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/NoNoArgs.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/NoNoArgs.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/NoNoArgs.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,31 @@
+/*
+ * 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.enhance.common.apps;
+
+import javax.persistence.Entity;
+
+@Entity
+public class NoNoArgs {
+
+    private String name;
+
+    public NoNoArgs(String n) {
+        name = n;
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/NonPCClone.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/NonPCClone.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/NonPCClone.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/NonPCClone.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.enhance.common.apps;
+
+import javax.persistence.Entity;
+
+@Entity
+public class NonPCClone {
+
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/PCClone.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/PCClone.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/PCClone.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/PCClone.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,43 @@
+/*
+ * 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.enhance.common.apps;
+
+import javax.persistence.Entity;
+
+@Entity
+public class PCClone implements Cloneable {
+
+    private String string;
+
+    public PCClone(String str) {
+        this.string = str;
+    }
+
+    public String getString() {
+        return string;
+    }
+
+    public Object clone() {
+        try {
+            return (PCClone) super.clone();
+        } catch (CloneNotSupportedException cnfe) {
+            return null;
+        }
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/SubclassClone.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/SubclassClone.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/SubclassClone.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/SubclassClone.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,43 @@
+/*
+ * 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.enhance.common.apps;
+
+import javax.persistence.Entity;
+
+@Entity
+public class SubclassClone extends NonPCClone implements Cloneable {
+
+    private String string;
+
+    public SubclassClone(String str) {
+        this.string = str;
+    }
+
+    public String getString() {
+        return string;
+    }
+
+    public SubclassClone safeClone() {
+        try {
+            return (SubclassClone) super.clone();
+        } catch (CloneNotSupportedException cnfe) {
+            return null;
+        }
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/SubclassTestInstance.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/SubclassTestInstance.java?rev=627979&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/SubclassTestInstance.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/common/apps/SubclassTestInstance.java Fri Feb 15 01:19:55 2008
@@ -0,0 +1,30 @@
+/*
+ * 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.enhance.common.apps;
+
+/**
+ * The various subclass test classes that we use all implement this interface,
+ * to allow reuse in some of the unit tests.
+ */
+public interface SubclassTestInstance {
+
+    public void setStringField(String s);
+
+    public String getStringField();
+}



Mime
View raw message