openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fayw...@apache.org
Subject svn commit: r950604 - in /openjpa/branches/2.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql: DB2Dictionary.java DBDictionary.java
Date Wed, 02 Jun 2010 15:42:20 GMT
Author: faywang
Date: Wed Jun  2 15:42:20 2010
New Revision: 950604

URL: http://svn.apache.org/viewvc?rev=950604&view=rev
Log:
OPENJPA-1596: port the change to 2.0

Modified:
    openjpa/branches/2.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
    openjpa/branches/2.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java

Modified: openjpa/branches/2.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java?rev=950604&r1=950603&r2=950604&view=diff
==============================================================================
--- openjpa/branches/2.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
(original)
+++ openjpa/branches/2.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
Wed Jun  2 15:42:20 2010
@@ -33,6 +33,7 @@ import java.util.Set;
 import java.util.StringTokenizer;
 
 import org.apache.openjpa.jdbc.identifier.DBIdentifier;
+import org.apache.openjpa.jdbc.identifier.QualifiedDBIdentifier;
 import org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration;
 import org.apache.openjpa.jdbc.kernel.exps.FilterValue;
 import org.apache.openjpa.jdbc.kernel.exps.Lit;
@@ -912,8 +913,10 @@ public class DB2Dictionary
             // build the index for the sequence tables
             // the index name will be the fully qualified table name + _IDX
             Table tab = schema.getTable(table);
-            DBIdentifier idxName = DBIdentifier.append(tab.getFullIdentifier(), "IDX");
-            Index idx = tab.addIndex(getValidIndexName(idxName, tab));
+            DBIdentifier fullIdxId = tab.getFullIdentifier().clone();
+            DBIdentifier unQualifiedName = DBIdentifier.append(fullIdxId.getUnqualifiedName(),
"IDX");
+            fullIdxId.setName(getValidIndexName(unQualifiedName, tab));
+            Index idx = tab.addIndex(fullIdxId);
             idx.setUnique(true);
             idx.addColumn(pkColumn);
         }

Modified: openjpa/branches/2.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java?rev=950604&r1=950603&r2=950604&view=diff
==============================================================================
--- openjpa/branches/2.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
(original)
+++ openjpa/branches/2.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
Wed Jun  2 15:42:20 2010
@@ -3408,8 +3408,13 @@ public class DBDictionary
         buf.append("CREATE ");
         if (index.isUnique())
             buf.append("UNIQUE ");
-        String indexName = checkNameLength(toDBName(index.getIdentifier()), maxIndexNameLength,

+        
+        DBIdentifier fullIdxName = index.getIdentifier();
+        DBIdentifier unQualifiedName = fullIdxName.getUnqualifiedName();
+        checkNameLength(toDBName(unQualifiedName), maxIndexNameLength, 
                 "long-index-name");
+        String indexName = toDBName(fullIdxName);
+         
         buf.append("INDEX ").append(indexName);
         buf.append(" ON ").append(getFullName(index.getTable(), false));
         buf.append(" (").append(namingUtil.appendColumns(index.getColumns())).



Mime
View raw message