OPENJPA-2336: Consider database dictionary schema case while matching join column name

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1447945 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Pinaki Poddar 2013-02-19 22:30:34 +00:00
parent 7ce7e55620
commit 4fbf3fc1f0
1 changed files with 13 additions and 4 deletions

View File

@ -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());