openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dick <michael.d.d...@gmail.com>
Subject Re: Revision 736066 of TestMultipleSchemaNames
Date Tue, 03 Feb 2009 16:30:17 GMT
Hi Milosz,

Sorry about that (obviously) I didn't run that change on PostGres and I
missed the comments. For now I'm going to just remove the
System.err.println. Alternatively we could catch and re-throw the exception
after cleaning up.

Just running a sanity check build before committing.


On Tue, Feb 3, 2009 at 4:49 AM, MiƂosz Tylenda <mtylenda@o2.pl> wrote:

> 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);
>     }
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message