mirror of https://github.com/apache/openjpa.git
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:
parent
7ce7e55620
commit
4fbf3fc1f0
|
@ -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());
|
||||
|
|
Loading…
Reference in New Issue