You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by ht...@apache.org on 2013/07/29 21:15:28 UTC

svn commit: r1508184 - /openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java

Author: hthomann
Date: Mon Jul 29 19:15:28 2013
New Revision: 1508184

URL: http://svn.apache.org/r1508184
Log:
OPENJPA-2387: Fix to exclude schema name when checking the length of a sequence name.  Made update to ensure schema is used after length is calculated.

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

Modified: openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java?rev=1508184&r1=1508183&r2=1508184&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java (original)
+++ openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java Mon Jul 29 19:15:28 2013
@@ -28,7 +28,6 @@ import java.io.OutputStream;
 import java.io.Reader;
 import java.io.StringReader;
 import java.io.Writer;
-import java.lang.reflect.Method;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.sql.Array;
@@ -3488,9 +3487,19 @@ public class DBDictionary
 
         StringBuilder buf = new StringBuilder();
         buf.append(create ? "CREATE" : "ALTER").append(" SEQUENCE ");
-        
-        String seqName = checkNameLength(toDBName(seq.getFullIdentifier().getUnqualifiedName()), 
+        //new:
+//        String seqName = checkNameLength(toDBName(seq.getFullIdentifier().getUnqualifiedName()), 
+  //          maxTableNameLength, "long-seq-name");
+        //old:
+//        String seqName = checkNameLength(getFullName(seq), maxTableNameLength, 
+  //      "long-seq-name");        
+        //new new:
+        //Strip off the schema and verify the sequence name is within the legal length, NOT
+        //the schema name + sequence name.
+        checkNameLength(toDBName(seq.getFullIdentifier().getUnqualifiedName()), 
             maxTableNameLength, "long-seq-name");
+        //Now use the full sequence name (schema + sequence name).
+        String seqName = getFullName(seq);
 
         buf.append(seqName);
         if (create && seq.getInitialValue() != 0)