You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2010/10/07 22:46:45 UTC

svn commit: r1005628 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java

Author: doogie
Date: Thu Oct  7 20:46:45 2010
New Revision: 1005628

URL: http://svn.apache.org/viewvc?rev=1005628&view=rev
Log:
Fix checking of combined schema.tableName; the schema needed to be
normalized.  This fixes oracle at startup, so that it doesn't wrongly
thing that no tables are defined in the database.

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java?rev=1005628&r1=1005627&r2=1005628&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java Thu Oct  7 20:46:45 2010
@@ -187,6 +187,16 @@ public class DatabaseUtil {
         int curEnt = 0;
         int totalEnt = modelEntityList.size();
         List<ModelEntity> entitiesAdded = FastList.newInstance();
+        String schemaName;
+        try {
+            DatabaseMetaData dbData = this.getDatabaseMetaData(null, messages);
+            schemaName = getSchemaName(dbData);
+        } catch (SQLException e) {
+            String message = "Could not get schema name the database, aborting.";
+            if (messages != null) messages.add(message);
+            Debug.logError(message, module);
+            return;
+        }
         for (ModelEntity entity: modelEntityList) {
             curEnt++;
 
@@ -198,7 +208,13 @@ public class DatabaseUtil {
                 continue;
             }
 
-            String tableName = entity.getTableName(datasourceInfo);
+            String plainTableName = entity.getPlainTableName();
+            String tableName;
+            if (UtilValidate.isNotEmpty(schemaName)) {
+                tableName = schemaName + "." + plainTableName;
+            } else {
+                tableName = plainTableName;
+            }
             String entMessage = "(" + timer.timeSinceLast() + "ms) Checking #" + curEnt + "/" + totalEnt +
                 " Entity " + entity.getEntityName() + " with table " + tableName;