openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ppod...@apache.org
Subject svn commit: r1447945 - /openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java
Date Tue, 19 Feb 2013 22:30:35 GMT
Author: ppoddar
Date: Tue Feb 19 22:30:34 2013
New Revision: 1447945

URL: http://svn.apache.org/r1447945
Log:
OPENJPA-2336: Consider database dictionary schema case while matching join column name

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java?rev=1447945&r1=1447944&r2=1447945&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java
Tue Feb 19 22:30:34 2013
@@ -1530,10 +1530,19 @@ public abstract class MappingInfo
         tmplate.setIdentifier(name);
         if (!constant) {
             Column tcol = foreign.getColumn(targetName, false); 
-            if (tcol == null)
-                throw new MetaDataException(_loc.get(prefix + "-bad-fktarget",
-                    new Object[]{ context, targetName, name, foreign }));
-
+            if (tcol == null) {
+            	String schemaCase = rel.getMappingRepository().getDBDictionary().schemaCase;
+            	if (DBDictionary.SCHEMA_CASE_LOWER.equals(schemaCase)) {
+                	tcol = foreign.getColumn(DBIdentifier.toLower(targetName, true), false);
+            	} else if (DBDictionary.SCHEMA_CASE_UPPER.equals(schemaCase)) {
+            		tcol = foreign.getColumn(DBIdentifier.toUpper(targetName, true), false);
+            	}
+            }
+        	if (tcol == null) {
+        		// give up
+        		throw new MetaDataException(_loc.get(prefix + "-bad-fktarget",
+    				new Object[]{ context, targetName, name, foreign }));
+        	}
             if (DBIdentifier.isNull(name))
                 tmplate.setIdentifier(tcol.getIdentifier());
             tmplate.setJavaType(tcol.getJavaType());



Mime
View raw message