openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jrba...@apache.org
Subject svn commit: r818987 - in /openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers: ./ noschema/
Date Fri, 25 Sep 2009 20:15:13 GMT
Author: jrbauer
Date: Fri Sep 25 20:15:12 2009
New Revision: 818987

URL: http://svn.apache.org/viewvc?rev=818987&view=rev
Log:
OPENJPA-1115 Targeted delimited id tests for specific DB platforms based on schema support/usage.  Includes test updates contributed by Dianne Richards.

Added:
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityC.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD2.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD3.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD4.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityE.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityF.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityG.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimId.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimIdSeqGen.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimInheritance.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimitedJoinAnnotations.java
Modified:
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/EntityE.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/EntityF.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/EntityG.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/TestManualDelimId.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/TestManualDelimIdResultSetAnnotations.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/TestManualDelimIdSeqGen.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/TestManualDelimInheritance.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/TestManualDelimitedJoinAnnotations.java

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/EntityE.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/EntityE.java?rev=818987&r1=818986&r2=818987&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/EntityE.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/EntityE.java Fri Sep 25 20:15:12 2009
@@ -27,12 +27,11 @@
 import javax.persistence.Table;
 
 @Entity
-//@Table(name="primary_entityE", schema="delim_id")
 @Table(name="\"primary entityE\"", schema="\"delim id\"")
 public class EntityE {
     @Id
     @SequenceGenerator(name="entityE_seq_gen_name", 
-        sequenceName="\"entityE_seq_gen\"", schema="\"delim_id\"")
+        sequenceName="\"entityE_seq_gen\"", schema="\"delim id\"")
     @GeneratedValue(strategy=GenerationType.SEQUENCE, 
         generator="entityE_seq_gen_name")
     private int id;
@@ -41,14 +40,8 @@
     
     public EntityE(String name) {
         this.name = name;
-//        id = 1;
     }
     
-//    public EntityE(int id, String name) {
-//        this.id = id;
-//        this.name = name;
-//    }
-    
     /**
      * @return the id
      */

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/EntityF.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/EntityF.java?rev=818987&r1=818986&r2=818987&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/EntityF.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/EntityF.java Fri Sep 25 20:15:12 2009
@@ -77,8 +77,8 @@
     @ElementCollection
     // Note: Delimited column definition is not supported on some DBs, so
     // it is not delimited here
-    // TODO: create a separate entity and conditionally run the test
-    @MapKeyColumn(name="\"mapKey\"", columnDefinition="varchar(20)")
+    // TODO: create a separate entity and conditionally run the test on a supported DB
+    @MapKeyColumn(name="\"mapKey\"", columnDefinition="varchar(20)", table="\"delim collection map\"")
     private Map<String, String> delimCollectionMap = 
         new HashMap<String, String>();
     

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/EntityG.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/EntityG.java?rev=818987&r1=818986&r2=818987&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/EntityG.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/EntityG.java Fri Sep 25 20:15:12 2009
@@ -25,10 +25,8 @@
 
 @Entity
 @Table(name="\"entity d4\"", schema="\"delim id\"")
-//@Table(name="xxx")
 public class EntityG {
     @Id
-//    @Column(name="\"entityD4 id\"")
     int id;
     String name;
     

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/TestManualDelimId.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/TestManualDelimId.java?rev=818987&r1=818986&r2=818987&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/TestManualDelimId.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/TestManualDelimId.java Fri Sep 25 20:15:12 2009
@@ -22,6 +22,8 @@
 
 import javax.persistence.Query;
 
+import org.apache.openjpa.jdbc.sql.DB2Dictionary;
+import org.apache.openjpa.jdbc.sql.DerbyDictionary;
 import org.apache.openjpa.persistence.OpenJPAEntityManager;
 import org.apache.openjpa.persistence.test.SQLListenerTestCase;
 
@@ -31,6 +33,13 @@
     
     @Override
     public void setUp() throws Exception {
+        // NOTE: This test is only configured to run on DB2 and Derby since 
+        // those DBs handle non-default schemas without additional authority or 
+        // configuration  
+        setSupportedDatabases(DB2Dictionary.class, DerbyDictionary.class);
+        if (isTestsDisabled())
+            return;
+        
         super.setUp(
             org.apache.openjpa.persistence.delimited.identifiers.EntityF.class,
             DROP_TABLES);

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/TestManualDelimIdResultSetAnnotations.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/TestManualDelimIdResultSetAnnotations.java?rev=818987&r1=818986&r2=818987&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/TestManualDelimIdResultSetAnnotations.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/TestManualDelimIdResultSetAnnotations.java Fri Sep 25 20:15:12 2009
@@ -22,6 +22,8 @@
 
 import javax.persistence.Query;
 
+import org.apache.openjpa.jdbc.sql.DB2Dictionary;
+import org.apache.openjpa.jdbc.sql.DerbyDictionary;
 import org.apache.openjpa.persistence.OpenJPAEntityManager;
 import org.apache.openjpa.persistence.test.SQLListenerTestCase;
 
@@ -38,6 +40,13 @@
     
     @Override
     public void setUp() throws Exception {
+        // NOTE: This test is only configured to run on DB2 and Derby since 
+        // those DBs handle non-default schemas without additional authority or 
+        // configuration  
+        setSupportedDatabases(DB2Dictionary.class, DerbyDictionary.class);
+        if (isTestsDisabled())
+            return;
+        
         super.setUp(
             org.apache.openjpa.persistence.delimited.identifiers.Animal.class,
             org.apache.openjpa.persistence.delimited.identifiers.Dog.class,

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/TestManualDelimIdSeqGen.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/TestManualDelimIdSeqGen.java?rev=818987&r1=818986&r2=818987&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/TestManualDelimIdSeqGen.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/TestManualDelimIdSeqGen.java Fri Sep 25 20:15:12 2009
@@ -19,7 +19,9 @@
 package org.apache.openjpa.persistence.delimited.identifiers;
 
 import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
+import org.apache.openjpa.jdbc.sql.DB2Dictionary;
 import org.apache.openjpa.jdbc.sql.DBDictionary;
+import org.apache.openjpa.jdbc.sql.DerbyDictionary;
 import org.apache.openjpa.persistence.OpenJPAEntityManager;
 import org.apache.openjpa.persistence.test.SQLListenerTestCase;
 
@@ -33,6 +35,13 @@
     
     @Override
     public void setUp() throws Exception {
+        // NOTE: This test is only configured to run on DB2 and Derby since 
+        // those DBs handle non-default schemas without additional authority or 
+        // configuration  
+        setSupportedDatabases(DB2Dictionary.class, DerbyDictionary.class);
+        if (isTestsDisabled())
+            return;
+
         super.setUp(EntityE.class,DROP_TABLES);
         assertNotNull(emf);
         
@@ -50,37 +59,6 @@
         entityE = new EntityE("e name");
     }
     
-    // TODO: temp
-//    public void testDBCapability() {
-//        Connection conn = (Connection)em.getConnection();
-//        try {
-//            DatabaseMetaData meta = conn.getMetaData();
-//            System.out.println("LC - " + 
-//                meta.storesLowerCaseIdentifiers());
-//            System.out.println("LCQ - " + 
-//                meta.storesLowerCaseQuotedIdentifiers());
-//            System.out.println("MC - " + 
-//                meta.storesMixedCaseIdentifiers());
-//            System.out.println("MCQ - " + 
-//                meta.storesMixedCaseQuotedIdentifiers());
-//            System.out.println("UC - " + 
-//                meta.storesUpperCaseIdentifiers());
-//            System.out.println("UCQ - " + 
-//                meta.storesUpperCaseQuotedIdentifiers());
-//            
-//            System.out.println("db product name - " + 
-//                meta.getDatabaseProductName());
-//            System.out.println("db product version - " + 
-//                meta.getDatabaseProductVersion());
-//            System.out.println("driver name - " + 
-//                meta.getDriverName());
-//            System.out.println("driver version - " + 
-//                meta.getDriverVersion());
-//        } catch (SQLException e) {
-//            e.printStackTrace();
-//        }
-//    }
-    
     public void testSeqGen() {
         if (!supportsNativeSequence) {
             return;
@@ -90,11 +68,8 @@
         em.getTransaction().begin();
         em.persist(entityE);
         em.getTransaction().commit();
-        
-        System.out.println(super.toString(sql));
-        
+                
         int genId = entityE.getId();
-        System.out.println("generated id - " + genId);
         em.clear();
         em.getTransaction().begin();
         EntityE eA = em.find(EntityE.class, genId);

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/TestManualDelimInheritance.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/TestManualDelimInheritance.java?rev=818987&r1=818986&r2=818987&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/TestManualDelimInheritance.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/TestManualDelimInheritance.java Fri Sep 25 20:15:12 2009
@@ -5,7 +5,9 @@
 import javax.persistence.Query;
 
 import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
+import org.apache.openjpa.jdbc.sql.DB2Dictionary;
 import org.apache.openjpa.jdbc.sql.DBDictionary;
+import org.apache.openjpa.jdbc.sql.DerbyDictionary;
 import org.apache.openjpa.persistence.OpenJPAEntityManager;
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -32,22 +34,25 @@
     int id = 0;
     Dog dog;
     Cat cat;
-    JDBCConfiguration conf;
-    DBDictionary dict;
     
     @Override
     public void setUp() throws Exception {
+        // NOTE: This test is only configured to run on DB2 and Derby since 
+        // those DBs handle non-default schemas without additional authority or 
+        // configuration  
+        setSupportedDatabases(DB2Dictionary.class, DerbyDictionary.class);
+        if (isTestsDisabled())
+            return;
+
         super.setUp(
             org.apache.openjpa.persistence.delimited.identifiers.Animal.class,
             org.apache.openjpa.persistence.delimited.identifiers.Dog.class,
-            org.apache.openjpa.persistence.delimited.identifiers.Cat.class);
+            org.apache.openjpa.persistence.delimited.identifiers.Cat.class,
+            DROP_TABLES);
         assertNotNull(emf);
         
         em = emf.createEntityManager();
         assertNotNull(em);
-        
-        conf = (JDBCConfiguration) emf.getConfiguration();
-        dict = conf.getDBDictionaryInstance();
     }
     
     private void createDog(int id) {

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/TestManualDelimitedJoinAnnotations.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/TestManualDelimitedJoinAnnotations.java?rev=818987&r1=818986&r2=818987&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/TestManualDelimitedJoinAnnotations.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/TestManualDelimitedJoinAnnotations.java Fri Sep 25 20:15:12 2009
@@ -23,7 +23,9 @@
 import javax.persistence.Query;
 
 import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
+import org.apache.openjpa.jdbc.sql.DB2Dictionary;
 import org.apache.openjpa.jdbc.sql.DBDictionary;
+import org.apache.openjpa.jdbc.sql.DerbyDictionary;
 import org.apache.openjpa.persistence.OpenJPAEntityManager;
 import org.apache.openjpa.persistence.test.SQLListenerTestCase;
 
@@ -40,6 +42,13 @@
     
     @Override
     public void setUp() throws Exception {
+        // NOTE: This test is only configured to run on DB2 and Derby since 
+        // those DBs handle non-default schemas without additional authority or 
+        // configuration  
+        setSupportedDatabases(DB2Dictionary.class, DerbyDictionary.class);
+        if (isTestsDisabled())
+            return;
+        
         super.setUp(
             org.apache.openjpa.persistence.delimited.identifiers.EntityC.class,
             org.apache.openjpa.persistence.delimited.identifiers.EntityD.class,

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityC.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityC.java?rev=818987&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityC.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityC.java Fri Sep 25 20:15:12 2009
@@ -0,0 +1,181 @@
+/*
+ * 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.delimited.identifiers.noschema;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
+import javax.persistence.MapKeyJoinColumn;
+import javax.persistence.OneToOne;
+import javax.persistence.PrimaryKeyJoinColumn;
+import javax.persistence.SecondaryTable;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="\"entity c\"")
+@SecondaryTable(name="\"sec join table\"",
+    pkJoinColumns=@PrimaryKeyJoinColumn(name="\"entity c\"",
+        referencedColumnName="\"c id\""))
+public class EntityC {
+    @Id
+    @Column(name="\"c id\"")
+    private int id;
+    private String name;
+    
+    @Column(table="\"sec join table\"")
+    private String secName;
+    
+    @ManyToMany
+    @JoinTable(name="\"c d\"")
+    private Collection<EntityD> entityDs = new HashSet<EntityD>();
+    
+    @OneToOne
+    @JoinColumn(name="\"entd2 id\"", referencedColumnName="\"entityD2 id\"")
+    private EntityD2 entityD2;
+    
+    @ManyToMany
+    @JoinTable(name="\"map join table\"")
+    @MapKeyJoinColumn(name="map_ed3", referencedColumnName="\"entityD3 id\"")
+    Map<EntityD3,EntityD4> map = new HashMap<EntityD3,EntityD4>();
+    
+    @ManyToMany
+    @JoinTable(name="\"map2 join table\"")
+    @MapKeyJoinColumn(name="\"map ed4\"", 
+        referencedColumnName="\"entityD4 id\"")
+    Map<EntityD4,EntityD3> map2 = new HashMap<EntityD4,EntityD3>();
+    
+    public EntityC() {}
+    
+    public EntityC(int id) {
+        this.id = id;
+    }
+    
+    /**
+     * @return the id
+     */
+    public int getId() {
+        return id;
+    }
+    /**
+     * @param id the id to set
+     */
+    public void setId(int id) {
+        this.id = id;
+    }
+    /**
+     * @return the name
+     */
+    public String getName() {
+        return name;
+    }
+    /**
+     * @param name the name to set
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+    /**
+     * @return the entityDs
+     */
+    public Collection<EntityD> getEntityDs() {
+        return entityDs;
+    }
+    /**
+     * @param entityDs the entityDs to set
+     */
+    public void setEntityDs(Collection<EntityD> entityDs) {
+        this.entityDs = entityDs;
+    }
+    
+    public void addEntityD(EntityD entityD) {
+        entityDs.add(entityD);
+    }
+
+    /**
+     * @return the entityD2
+     */
+    public EntityD2 getEntityD2() {
+        return entityD2;
+    }
+
+    /**
+     * @param entityD2 the entityD2 to set
+     */
+    public void setEntityD2(EntityD2 entityD2) {
+        this.entityD2 = entityD2;
+    }
+
+    /**
+     * @return the map
+     */
+    public Map<EntityD3, EntityD4> getMap() {
+        return map;
+    }
+
+    /**
+     * @param map the map to set
+     */
+    public void setMap(Map<EntityD3, EntityD4> map) {
+        this.map = map;
+    }
+    
+    public void addMapValues(EntityD3 key, EntityD4 value) {
+        map.put(key, value);
+    }
+
+    /**
+     * @return the map2
+     */
+    public Map<EntityD4, EntityD3> getMap2() {
+        return map2;
+    }
+
+    /**
+     * @param map2 the map2 to set
+     */
+    public void setMap2(Map<EntityD4, EntityD3> map2) {
+        this.map2 = map2;
+    }
+    
+    public void addMap2Values(EntityD4 key, EntityD3 value) {
+        map2.put(key, value);
+    }
+
+    /**
+     * @return the secName
+     */
+    public String getSecName() {
+        return secName;
+    }
+
+    /**
+     * @param secName the secName to set
+     */
+    public void setSecName(String secName) {
+        this.secName = secName;
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD.java?rev=818987&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD.java Fri Sep 25 20:15:12 2009
@@ -0,0 +1,89 @@
+/*
+ * 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.delimited.identifiers.noschema;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.ManyToMany;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="\"entity d\"")
+public class EntityD {
+    @Id
+    private int id;
+    private String name;
+    @ManyToMany(mappedBy="entityDs")
+    private Collection<EntityC> entityCs = new HashSet<EntityC>();
+    
+    public EntityD() {}
+    
+    public EntityD(int id) {
+        this.id = id;
+    }
+
+    /**
+     * @return the id
+     */
+    public int getId() {
+        return id;
+    }
+
+    /**
+     * @param id the id to set
+     */
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    /**
+     * @return the name
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * @param name the name to set
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * @return the entityCs
+     */
+    public Collection<EntityC> getEntityCs() {
+        return entityCs;
+    }
+
+    /**
+     * @param entityCs the entityCs to set
+     */
+    public void setEntityCs(Collection<EntityC> entityCs) {
+        this.entityCs = entityCs;
+    }
+    
+    public void addEntityC(EntityC entityC) {
+        entityCs.add(entityC);
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD2.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD2.java?rev=818987&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD2.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD2.java Fri Sep 25 20:15:12 2009
@@ -0,0 +1,87 @@
+/*
+ * 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.delimited.identifiers.noschema;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.OneToOne;
+import javax.persistence.PrimaryKeyJoinColumn;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="\"entity d2\"")
+public class EntityD2 {
+    @Id
+    @Column(name="\"entityD2 id\"")
+    private int id;
+    private String name;
+    
+    @OneToOne
+    @PrimaryKeyJoinColumn
+    private EntityD3 entityD3;
+    
+    public EntityD2() {}
+    
+    public EntityD2(int id) {
+        this.id = id;
+    }
+
+    /**
+     * @return the id
+     */
+    public int getId() {
+        return id;
+    }
+
+    /**
+     * @param id the id to set
+     */
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    /**
+     * @return the name
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * @param name the name to set
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * @return the entityD3
+     */
+    public EntityD3 getEntityD3() {
+        return entityD3;
+    }
+
+    /**
+     * @param entityD3 the entityD3 to set
+     */
+    public void setEntityD3(EntityD3 entityD3) {
+        this.entityD3 = entityD3;
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD3.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD3.java?rev=818987&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD3.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD3.java Fri Sep 25 20:15:12 2009
@@ -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.delimited.identifiers.noschema;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="\"entity d3\"")
+public class EntityD3 {
+    @Id
+    @Column(name="\"entityD3 id\"")
+    int id;
+    String name;
+    
+    public EntityD3() {}
+    
+    public EntityD3(int id) {
+        this.id = id;
+    }
+    
+    /**
+     * @return the id
+     */
+    public int getId() {
+        return id;
+    }
+    /**
+     * @param id the id to set
+     */
+    public void setId(int id) {
+        this.id = id;
+    }
+    /**
+     * @return the name
+     */
+    public String getName() {
+        return name;
+    }
+    /**
+     * @param name the name to set
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD4.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD4.java?rev=818987&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD4.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityD4.java Fri Sep 25 20:15:12 2009
@@ -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.delimited.identifiers.noschema;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="\"entity d4\"")
+public class EntityD4 {
+    @Id
+    @Column(name="\"entityD4 id\"")
+    int id;
+    String name;
+    
+    public EntityD4() {}
+    
+    public EntityD4(int id) {
+        this.id = id;
+    }
+    
+    /**
+     * @return the id
+     */
+    public int getId() {
+        return id;
+    }
+    /**
+     * @param id the id to set
+     */
+    public void setId(int id) {
+        this.id = id;
+    }
+    /**
+     * @return the name
+     */
+    public String getName() {
+        return name;
+    }
+    /**
+     * @param name the name to set
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityE.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityE.java?rev=818987&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityE.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityE.java Fri Sep 25 20:15:12 2009
@@ -0,0 +1,69 @@
+/*
+ * 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.delimited.identifiers.noschema;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.SequenceGenerator;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="\"primary entityE\"")
+public class EntityE {
+    @Id
+    @SequenceGenerator(name="entityE_seq_gen_name", 
+        sequenceName="\"entityE_seq_gen\"")
+    @GeneratedValue(strategy=GenerationType.SEQUENCE, 
+        generator="entityE_seq_gen_name")
+    private int id;
+    @Column(name="e_name")
+    private String name;
+    
+    public EntityE(String name) {
+        this.name = name;
+    }
+    
+    /**
+     * @return the id
+     */
+    public int getId() {
+        return id;
+    }
+    /**
+     * @param id the id to set
+     */
+    public void setId(int id) {
+        this.id = id;
+    }
+    /**
+     * @return the name
+     */
+    public String getName() {
+        return name;
+    }
+    /**
+     * @param name the name to set
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityF.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityF.java?rev=818987&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityF.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityF.java Fri Sep 25 20:15:12 2009
@@ -0,0 +1,212 @@
+/*
+ * 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.delimited.identifiers.noschema;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.persistence.CollectionTable;
+import javax.persistence.Column;
+import javax.persistence.ElementCollection;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.MapKeyColumn;
+import javax.persistence.SecondaryTable;
+import javax.persistence.Table;
+import javax.persistence.TableGenerator;
+import javax.persistence.UniqueConstraint;
+
+@Entity
+@Table(name="\"primary entityF\"",
+    uniqueConstraints=
+        @UniqueConstraint(columnNames={"\"f name\"", "f_nonDelimName"}))
+@SecondaryTable(name="\"secondary entityF\"",
+    uniqueConstraints=
+        @UniqueConstraint(name="\"sec_unq\"", 
+            columnNames={"\"secondary name\""}))         
+public class EntityF {
+    @TableGenerator(name = "f_id_gen", table = "\"f_id_gen\"", 
+        pkColumnName = "\"gen_pk\"", valueColumnName = "\"gen_value\"")
+    @GeneratedValue(strategy = GenerationType.TABLE, generator = "f_id_gen")
+    @Id
+    private int id;
+    // Note: Delimited columnDefinition is not supported on some DBs
+    // TODO: copy into a separate entity and conditionally run a different test
+    @Column(name="\"f name\"", columnDefinition="varchar(15)")
+    private String name;
+    @Column(name="f_nonDelimName")
+    private String nonDelimName;
+    @Column(name="\"secondary name\"", table="\"secondary entityF\"")
+    private String secName;
+    
+    @ElementCollection
+    // CollectionTable with default name generation
+    @CollectionTable
+    private Set<String> collectionSet = new HashSet<String>();
+    
+    @ElementCollection
+    @CollectionTable(name="\"collectionDelimSet\"")
+    private Set<String> collectionDelimSet = new HashSet<String>();
+    
+    @ElementCollection
+    // MapKeyColumn with default name generation
+    @MapKeyColumn
+    private Map<String, String> collectionMap = new HashMap<String, String>();
+    
+    @ElementCollection
+    // Note: Delimited column definition is not supported on some DBs, so
+    // it is not delimited here
+    // TODO: create a separate entity and conditionally run the test on a supported DB
+    @MapKeyColumn(name="\"mapKey\"", columnDefinition="varchar(20)", table="\"delim collection map\"")
+    private Map<String, String> delimCollectionMap = 
+        new HashMap<String, String>();
+    
+    public EntityF(String name) {
+        this.name = name;
+    }
+    
+    /**
+     * @return the id
+     */
+    public int getId() {
+        return id;
+    }
+    /**
+     * @param id the id to set
+     */
+    public void setId(int id) {
+        this.id = id;
+    }
+    /**
+     * @return the name
+     */
+    public String getName() {
+        return name;
+    }
+    /**
+     * @param name the name to set
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * @return the nonDelimName
+     */
+    public String getNonDelimName() {
+        return nonDelimName;
+    }
+
+    /**
+     * @param nonDelimName the nonDelimName to set
+     */
+    public void setNonDelimName(String nonDelimName) {
+        this.nonDelimName = nonDelimName;
+    }
+
+    /**
+     * @return the secName
+     */
+    public String getSecName() {
+        return secName;
+    }
+
+    /**
+     * @param secName the secName to set
+     */
+    public void setSecName(String secName) {
+        this.secName = secName;
+    }
+
+    /**
+     * @return the collectionSet
+     */
+    public Set<String> getCollectionSet() {
+        return collectionSet;
+    }
+
+    /**
+     * @param collectionSet the collectionSet to set
+     */
+    public void setCollectionSet(Set<String> collectionSet) {
+        this.collectionSet = collectionSet;
+    }
+    
+    public void addCollectionSet(String item) {
+        collectionSet.add(item);
+    }
+
+    /**
+     * @return the collectionNamedSet
+     */
+    public Set<String> getCollectionDelimSet() {
+        return collectionDelimSet;
+    }
+
+    /**
+     * @param collectionNamedSet the collectionNamedSet to set
+     */
+    public void setCollectionDelimSet(Set<String> collectionDelimSet) {
+        this.collectionDelimSet = collectionDelimSet;
+    } 
+    
+    public void addCollectionDelimSet(String item) {
+        this.collectionDelimSet.add(item);
+    }
+
+    /**
+     * @return the collectionMap
+     */
+    public Map<String, String> getCollectionMap() {
+        return collectionMap;
+    }
+
+    /**
+     * @param collectionMap the collectionMap to set
+     */
+    public void setCollectionMap(Map<String, String> collectionMap) {
+        this.collectionMap = collectionMap;
+    }
+
+    public void addCollectionMap(String key, String value) {
+        collectionMap.put(key, value);
+    }
+
+    /**
+     * @return the delimCollectionMap
+     */
+    public Map<String, String> getDelimCollectionMap() {
+        return delimCollectionMap;
+    }
+
+    /**
+     * @param delimCollectionMap the delimCollectionMap to set
+     */
+    public void setDelimCollectionMap(Map<String, String> delimCollectionMap) {
+        this.delimCollectionMap = delimCollectionMap;
+    }
+    
+    public void addDelimCollectionMap(String key, String value) {
+        delimCollectionMap.put(key, value);
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityG.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityG.java?rev=818987&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityG.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/EntityG.java Fri Sep 25 20:15:12 2009
@@ -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.delimited.identifiers.noschema;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="\"entity d4\"")
+public class EntityG {
+    @Id
+    int id;
+    String name;
+    
+    public EntityG() {}
+    
+    public EntityG(int id) {
+        this.id = id;
+    }
+    
+    public EntityG(int id, String name) {
+        this.id = id;
+        this.name = name;
+    }
+    
+    /**
+     * @return the id
+     */
+    public int getId() {
+        return id;
+    }
+    /**
+     * @param id the id to set
+     */
+    public void setId(int id) {
+        this.id = id;
+    }
+    /**
+     * @return the name
+     */
+    public String getName() {
+        return name;
+    }
+    /**
+     * @param name the name to set
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimId.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimId.java?rev=818987&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimId.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimId.java Fri Sep 25 20:15:12 2009
@@ -0,0 +1,128 @@
+/*
+ * 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.delimited.identifiers.noschema;
+
+import java.util.List;
+
+import javax.persistence.Query;
+
+import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
+import org.apache.openjpa.jdbc.sql.DB2Dictionary;
+import org.apache.openjpa.jdbc.sql.DBDictionary;
+import org.apache.openjpa.jdbc.sql.DerbyDictionary;
+import org.apache.openjpa.jdbc.sql.MySQLDictionary;
+import org.apache.openjpa.jdbc.sql.OracleDictionary;
+import org.apache.openjpa.persistence.OpenJPAEntityManager;
+import org.apache.openjpa.persistence.test.SQLListenerTestCase;
+
+public class TestNoSchemaManualDelimId extends SQLListenerTestCase {
+    OpenJPAEntityManager em;
+    EntityF entityF;
+    
+    @Override
+    public void setUp() throws Exception {
+        
+        // TODO: Delimiter support is currently limited to database that use
+        // double quote as a delimiter.
+        setUnsupportedDatabases(MySQLDictionary.class);
+        if (isTestsDisabled())
+            return;
+        
+        super.setUp(
+            org.apache.openjpa.persistence.delimited.identifiers.noschema.EntityF.class,
+            DROP_TABLES);
+        assertNotNull(emf);
+
+        em = emf.createEntityManager();
+        assertNotNull(em);
+    }
+
+    public void createEntityF() {
+        entityF = new EntityF("fName");
+        entityF.setNonDelimName("fNonDelimName");
+        entityF.setSecName("sec name");
+        entityF.addCollectionSet("xxx");
+        entityF.addCollectionSet("yyy");
+        entityF.addCollectionDelimSet("aaa");
+        entityF.addCollectionDelimSet("bbb");
+        entityF.addCollectionMap("aaa", "xxx");
+        entityF.addCollectionMap("bbb", "yyy");
+        entityF.addDelimCollectionMap("www", "xxx");
+        entityF.addDelimCollectionMap("yyy", "zzz");
+    }
+    
+    public void testCreateF() {
+        createEntityF();
+        
+        em.getTransaction().begin();
+        em.persist(entityF);
+        em.getTransaction().commit();
+        
+        runQueries();
+        
+    }
+    
+    // Run a second time to re-create a situation that initially caused a problem when running this
+    // test consecutive times.
+    public void testCreateF2() {
+        createEntityF();
+        
+        em.getTransaction().begin();
+        em.persist(entityF);
+        em.getTransaction().commit();
+    }
+    
+    private void runQueries() {
+        em.clear();
+        queryOnEntityOnly();
+        em.clear();
+        queryOnColumnValue();
+        em.clear();
+        queryCollection();
+    }
+    
+    private void queryOnEntityOnly() {
+        String query =
+            "SELECT DISTINCT f " +
+            "FROM EntityF f";
+        Query q = em.createQuery(query);
+        List<EntityF> results = (List<EntityF>)q.getResultList();
+        assertEquals(1,results.size());
+    }
+    
+    private void queryOnColumnValue() {
+        String query =
+            "SELECT DISTINCT f " +
+            "FROM EntityF f " +
+            "WHERE f.name = 'fName'";
+        Query q = em.createQuery(query);
+        List<EntityF> results = (List<EntityF>)q.getResultList();
+        assertEquals(1,results.size());
+    }
+    
+    private void queryCollection() {
+        String query =
+            "SELECT DISTINCT f " +
+            "FROM EntityF f, IN(f.collectionDelimSet) s " +
+            "WHERE s = 'aaa'";
+        Query q = em.createQuery(query);
+        List<EntityF> results = (List<EntityF>)q.getResultList();
+        assertEquals(1,results.size());
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimIdSeqGen.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimIdSeqGen.java?rev=818987&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimIdSeqGen.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimIdSeqGen.java Fri Sep 25 20:15:12 2009
@@ -0,0 +1,113 @@
+/*
+ * 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.delimited.identifiers.noschema;
+
+import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
+import org.apache.openjpa.jdbc.sql.DBDictionary;
+import org.apache.openjpa.jdbc.sql.MySQLDictionary;
+import org.apache.openjpa.persistence.OpenJPAEntityManager;
+import org.apache.openjpa.persistence.test.SQLListenerTestCase;
+
+public class TestNoSchemaManualDelimIdSeqGen extends SQLListenerTestCase {
+    OpenJPAEntityManager em;
+    JDBCConfiguration conf;
+    DBDictionary dict;
+    boolean supportsNativeSequence = false;
+    
+    EntityE entityE;
+    
+    @Override
+    public void setUp() throws Exception {
+
+        // TODO: Delimiter support is limited to 
+        setUnsupportedDatabases(MySQLDictionary.class);
+        if (isTestsDisabled())
+            return;
+        
+        super.setUp(EntityE.class,DROP_TABLES);
+        assertNotNull(emf);
+        
+        conf = (JDBCConfiguration) emf.getConfiguration();
+        dict = conf.getDBDictionaryInstance();
+        supportsNativeSequence = dict.nextSequenceQuery != null;
+        
+        if (supportsNativeSequence) {
+            em = emf.createEntityManager();
+            assertNotNull(em);
+        }
+    }
+    
+    public void createEntityE() {
+        entityE = new EntityE("e name");
+    }
+    
+    // TODO: temp
+//    public void testDBCapability() {
+//        Connection conn = (Connection)em.getConnection();
+//        try {
+//            DatabaseMetaData meta = conn.getMetaData();
+//            System.out.println("LC - " + 
+//                meta.storesLowerCaseIdentifiers());
+//            System.out.println("LCQ - " + 
+//                meta.storesLowerCaseQuotedIdentifiers());
+//            System.out.println("MC - " + 
+//                meta.storesMixedCaseIdentifiers());
+//            System.out.println("MCQ - " + 
+//                meta.storesMixedCaseQuotedIdentifiers());
+//            System.out.println("UC - " + 
+//                meta.storesUpperCaseIdentifiers());
+//            System.out.println("UCQ - " + 
+//                meta.storesUpperCaseQuotedIdentifiers());
+//            
+//            System.out.println("db product name - " + 
+//                meta.getDatabaseProductName());
+//            System.out.println("db product version - " + 
+//                meta.getDatabaseProductVersion());
+//            System.out.println("driver name - " + 
+//                meta.getDriverName());
+//            System.out.println("driver version - " + 
+//                meta.getDriverVersion());
+//        } catch (SQLException e) {
+//            e.printStackTrace();
+//        }
+//    }
+    
+    public void testSeqGen() {
+        if (!supportsNativeSequence) {
+            return;
+        }
+        createEntityE();
+        
+        em.getTransaction().begin();
+        em.persist(entityE);
+        em.getTransaction().commit();
+        
+        System.out.println(super.toString(sql));
+        
+        int genId = entityE.getId();
+        System.out.println("generated id - " + genId);
+        em.clear();
+        em.getTransaction().begin();
+        EntityE eA = em.find(EntityE.class, genId);
+        assertEquals("e name", eA.getName());
+        
+        em.getTransaction().commit();
+        em.close();
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimInheritance.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimInheritance.java?rev=818987&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimInheritance.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimInheritance.java Fri Sep 25 20:15:12 2009
@@ -0,0 +1,120 @@
+package org.apache.openjpa.persistence.delimited.identifiers.noschema;
+
+import java.util.List;
+
+import javax.persistence.Query;
+
+import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
+import org.apache.openjpa.jdbc.sql.DBDictionary;
+import org.apache.openjpa.jdbc.sql.MySQLDictionary;
+import org.apache.openjpa.persistence.OpenJPAEntityManager;
+/*
+ * 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.
+ */
+import org.apache.openjpa.persistence.delimited.identifiers.Animal;
+import org.apache.openjpa.persistence.delimited.identifiers.Cat;
+import org.apache.openjpa.persistence.delimited.identifiers.Dog;
+import org.apache.openjpa.persistence.test.DatabasePlatform;
+import org.apache.openjpa.persistence.test.SQLListenerTestCase;
+
+@DatabasePlatform(value="")
+public class TestNoSchemaManualDelimInheritance extends SQLListenerTestCase {
+    OpenJPAEntityManager em;
+    int id = 0;
+    Dog dog;
+    Cat cat;
+    JDBCConfiguration conf;
+    DBDictionary dict;
+    
+    @Override
+    public void setUp() throws Exception {
+        
+        // TODO: Delimiter support is currently limited to database that use
+        // double quote as a delimiter.
+        setUnsupportedDatabases(MySQLDictionary.class);
+        if (isTestsDisabled())
+            return;
+
+        super.setUp(
+            org.apache.openjpa.persistence.delimited.identifiers.Animal.class,
+            org.apache.openjpa.persistence.delimited.identifiers.Dog.class,
+            org.apache.openjpa.persistence.delimited.identifiers.Cat.class,
+            DROP_TABLES);
+        assertNotNull(emf);
+        
+        em = emf.createEntityManager();
+        assertNotNull(em);
+        
+        conf = (JDBCConfiguration) emf.getConfiguration();
+        dict = conf.getDBDictionaryInstance();
+    }
+    
+    private void createDog(int id) {
+        dog = new Dog(id);
+        dog.setName("Spot");
+        dog.setType("dog");
+    }
+    
+    private void createCat(int id) {
+        cat = new Cat(id);
+        cat.setName("Puff");
+        cat.setType("cat");
+    }
+    
+    public void testCreate() {
+        id++;
+        createDog(id);
+        id++;
+        createCat(id);
+        
+        em.getTransaction().begin();
+        em.persist(dog);
+        em.persist(cat);
+        em.getTransaction().commit();
+        
+        runQueries();
+    }
+    
+    private void runQueries() {
+        em.clear();
+        queryCat();
+        em.clear();
+        queryDog();
+    }
+    
+    private void queryCat() {
+        String query =
+            "SELECT DISTINCT a " +
+            "FROM Animal a " +
+            "WHERE a.type = 'cat'";
+        Query q = em.createQuery(query);
+        List<Animal> results = (List<Animal>)q.getResultList();
+        assertEquals(1,results.size());
+    }
+    
+    // Use native query
+    private void queryDog() {
+        String query = 
+            "SELECT * " +
+            "FROM \"Animal\" a " +
+            "WHERE a.\"discr col\" = 'Dog'";
+        Query q = em.createNativeQuery(query);
+        List<Animal> results = (List<Animal>)q.getResultList();
+        assertEquals(1,results.size());
+    }
+}

Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimitedJoinAnnotations.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimitedJoinAnnotations.java?rev=818987&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimitedJoinAnnotations.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/delimited/identifiers/noschema/TestNoSchemaManualDelimitedJoinAnnotations.java Fri Sep 25 20:15:12 2009
@@ -0,0 +1,163 @@
+/*
+ * 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.delimited.identifiers.noschema;
+
+import java.util.List;
+
+import javax.persistence.Query;
+
+import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
+import org.apache.openjpa.jdbc.sql.DBDictionary;
+import org.apache.openjpa.jdbc.sql.MySQLDictionary;
+import org.apache.openjpa.persistence.OpenJPAEntityManager;
+import org.apache.openjpa.persistence.test.SQLListenerTestCase;
+
+public class TestNoSchemaManualDelimitedJoinAnnotations extends SQLListenerTestCase {
+    OpenJPAEntityManager em;
+    int id = 0;
+    EntityC entityC;
+    EntityD entityD;
+    EntityD2 entityD2;
+    EntityD3 entityD3;
+    EntityD4 entityD4;
+    JDBCConfiguration conf;
+    DBDictionary dict;
+    
+    @Override
+    public void setUp() throws Exception {
+        
+        // TODO: Delimiter support is currently limited to database that use
+        // double quote as a delimiter.
+        setUnsupportedDatabases(MySQLDictionary.class);
+        if (isTestsDisabled())
+            return;
+
+        super.setUp(
+            org.apache.openjpa.persistence.delimited.identifiers.noschema.EntityC.class,
+            org.apache.openjpa.persistence.delimited.identifiers.noschema.EntityD.class,
+            org.apache.openjpa.persistence.delimited.identifiers.noschema.EntityD2.class,
+            org.apache.openjpa.persistence.delimited.identifiers.noschema.EntityD3.class,
+            org.apache.openjpa.persistence.delimited.identifiers.noschema.EntityD4.class,
+            DROP_TABLES);
+        assertNotNull(emf);
+        
+        em = emf.createEntityManager();
+        assertNotNull(em);
+        
+        conf = (JDBCConfiguration) emf.getConfiguration();
+        dict = conf.getDBDictionaryInstance();
+    }
+    
+    private void createCandD(int id) {
+        entityC = new EntityC(id);
+        entityC.setName("ec");
+        entityC.setSecName("secName1");
+        
+        entityD = new EntityD(id);
+        entityD.setName("ed");
+        
+        entityD2 = new EntityD2(id);
+        entityD2.setName("ed2");
+        
+        entityD3 = new EntityD3(id);
+        entityD3.setName("ed3");
+        
+        entityD4 = new EntityD4(id);
+        entityD4.setName("ed4");
+        
+        entityC.addEntityD(entityD);
+        entityD.addEntityC(entityC);
+        
+        entityC.setEntityD2(entityD2);
+        
+        entityC.addMapValues(entityD3, entityD4);
+        entityC.addMap2Values(entityD4, entityD3);
+        
+        entityD2.setEntityD3(entityD3);
+    }
+    
+    public void testCreate() {
+        id++;
+        createCandD(id);
+        // TODO: Maybe create another one.
+        
+        em.getTransaction().begin();
+        em.persist(entityC);
+        em.persist(entityD);
+        em.persist(entityD2);
+        em.persist(entityD3);
+        em.persist(entityD4);
+        em.getTransaction().commit();
+        
+        runQueries();
+    }
+    
+    private void runQueries() {
+        em.clear();
+        queryJoinTable();
+        em.clear();
+        queryJoinColumn();
+        em.clear();
+        querySecondaryTableValue();
+        em.clear();
+        queryMapValue();
+    }
+    
+    private void queryJoinTable() {
+        String query =
+            "SELECT c " +
+            "FROM EntityC c JOIN c.entityDs d " +
+            "WHERE d.name = 'ed'";
+        Query q = em.createQuery(query);
+        List<EntityC> results = (List<EntityC>)q.getResultList();
+        assertEquals(1,results.size());
+    }
+    
+    private void queryJoinColumn() {
+        String query = 
+            "SELECT c " +
+            "FROM EntityC c JOIN c.entityD2 d2 " +
+            "WHERE d2.name = 'ed2'";
+        Query q = em.createQuery(query);
+        List<EntityC> results = (List<EntityC>)q.getResultList();
+        assertEquals(1,results.size());
+    }
+    
+    private void querySecondaryTableValue() {
+        String query = 
+            "SELECT c " +
+            "FROM EntityC c " +
+            "WHERE c.secName = 'secName1'";
+        Query q = em.createQuery(query);
+        List<EntityC> results = (List<EntityC>)q.getResultList();
+        assertEquals(1,results.size());
+    }
+    
+    private void queryMapValue() {
+        String query =
+            "SELECT c " +
+            "FROM EntityC c, IN(c.map2) m " +
+            "WHERE m.name = 'ed3'";
+        Query q = em.createQuery(query);
+        List<EntityC> results = (List<EntityC>)q.getResultList();
+        assertEquals(1,results.size());
+    }
+        
+      
+}



Mime
View raw message