Hi Mike,

I am afraid that this change (removing try/catch) will prevent running the test 
(at least the first method) on PostgreSQL more than once. PostgreSQL needs 
explicit schema creation and the try/catch code was the easiest way I could 
find to handle the case when schemas are already created. Let me know if you 
think this should be done in another way.

Also, the closing of emf at the bottom of the method should rather stay as 
before as the emf is not used outside of the method.

This schema creation stuff was added to harness a bug concerning autoincrement 
columns in PostgreSQL. The diff follows.

Greetings,
Milosz

--- 
openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestMultipleSchemaNames.java
 (original)
+++ 
openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestMultipleSchemaNames.java
 Tue Jan 20 11:01:50 2009
@@ -417,19 +417,11 @@
         String[] schemas =
             { "SCHEMA1", "SCHEMA2", "SCHEMA3", "SCHEMA3G", "SCHEMA4G" };
         for (String schema : schemas) {
-            try {
-                em.getTransaction().begin();
-                Query q = em.createNativeQuery("create schema " + schema);
-                q.executeUpdate();
-                em.getTransaction().commit();
-            } catch (PersistenceException e) {
-                System.err.println("Exception caught while creating schema "
-                    + schema + ". Schema already exists? Message: "
-                    + e.getMessage());
-                em.getTransaction().rollback();
-            }
+            em.getTransaction().begin();
+            Query q = em.createNativeQuery("create schema " + schema);
+            q.executeUpdate();
+            em.getTransaction().commit();
         }
-        closeEMF(emf);
     } 

Reply via email to