openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mik...@apache.org
Subject svn commit: r603633 - /openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/PersistenceMappingDefaults.java
Date Wed, 12 Dec 2007 14:59:13 GMT
Author: mikedd
Date: Wed Dec 12 06:59:12 2007
New Revision: 603633

URL: http://svn.apache.org/viewvc?rev=603633&view=rev
Log:
OPENJPA-456 committing patch provided by Teresa Kan

Modified:
    openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/PersistenceMappingDefaults.java

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/PersistenceMappingDefaults.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/PersistenceMappingDefaults.java?rev=603633&r1=603632&r2=603633&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/PersistenceMappingDefaults.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/PersistenceMappingDefaults.java
Wed Dec 12 06:59:12 2007
@@ -157,9 +157,15 @@
             name = inverses[0].getName();
         else
             name = fm.getDefiningMapping().getTypeAlias();
-
+        String targetName = ((Column) target).getName();
+        String tempName = null;
+        if ((name.length() + targetName.length()) >= dict.maxColumnNameLength)
+            tempName = name.substring(0, dict.maxColumnNameLength
+                    - targetName.length() - 1);
         // suffix with '_' + target column
-        name += "_" + ((Column) target).getName();
+        if (tempName == null)
+            tempName = name;
+        name = tempName + "_" + targetName;
         name = dict.getValidColumnName(name, foreign);
         col.setName(name);
     }



Mime
View raw message