You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by jr...@apache.org on 2010/04/15 19:24:03 UTC

svn commit: r934493 - /openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaGenerator.java

Author: jrbauer
Date: Thu Apr 15 17:24:02 2010
New Revision: 934493

URL: http://svn.apache.org/viewvc?rev=934493&view=rev
Log:
OPENJPA-1605 Correct regression issue with table generation issue in schema generator.  Only the first table name returned in a generic DBMD query was used to populate the schema.  This broke the reverse mapping tool, which uses a generic query by default.

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaGenerator.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaGenerator.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaGenerator.java?rev=934493&r1=934492&r2=934493&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaGenerator.java (original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/SchemaGenerator.java Thu Apr 15 17:24:02 2010
@@ -572,9 +572,12 @@ public class SchemaGenerator {
         Schema schema;
         Table table;
         DBIdentifier tableSchema = DBIdentifier.NULL;
+        DBIdentifier baseTableName = (tableName == null) ? DBIdentifier.NULL : tableName.clone();
         for (int i = 0; cols != null && i < cols.length; i++) {
-            if (DBIdentifier.isNull(tableName) || tableName.equals("%")) {
+            if (DBIdentifier.isNull(baseTableName) || baseTableName.equals("%")) {
                 tableName = cols[i].getTableIdentifier();
+            } else {
+                tableName = baseTableName;
             }
             if (DBIdentifier.isNull(schemaName)) {
                 tableSchema = DBIdentifier.trimToNull(cols[i].getSchemaIdentifier());