diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-10 18:50:15 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-06-10 18:50:15 +0000 |
commit | 6dd671f2d670a33e369563cb85c748ccc4a7ff97 (patch) | |
tree | 5ef4b5759cff1f046468b2ea47660c937ab4ecd8 /java | |
parent | bc29529210b22534d8774d75f0e53d795d80911c (diff) |
TUSCANY-3088 - Applying patch with fixes to the following items :
- MappingWrapper.addImpliedRelationship(): SQL table names are case-insensitive
- MappingWrapper.getRelationshipByReference(): if 2 relationships have the same name, must check the containing type of the reference
- ResultMetadata: the structure of tableToPropertyMap is (table type name, list of property names), not (table name, list of property names)
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@783448 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
2 files changed, 6 insertions, 4 deletions
diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/MappingWrapper.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/MappingWrapper.java index 49ed64a922..6386df1927 100644 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/MappingWrapper.java +++ b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/config/wrapper/MappingWrapper.java @@ -150,7 +150,7 @@ public class MappingWrapper { Iterator i = config.getRelationship().iterator(); while (i.hasNext()) { Relationship r = (Relationship) i.next(); - if (r.getPrimaryKeyTable().equals(parentTableName) && r.getForeignKeyTable().equals(childTableName)) { + if (r.getPrimaryKeyTable().equalsIgnoreCase(parentTableName) && r.getForeignKeyTable().equalsIgnoreCase(childTableName)) { return; } } @@ -825,8 +825,10 @@ public class MappingWrapper { Iterator i = config.getRelationship().iterator(); while (i.hasNext()) { Relationship r = (Relationship) i.next(); - if (ref.getName().equals(r.getName()) || ref.getOpposite().getName().equals(r.getName())) { - return r; + if (ref.getName().equals(r.getName())) { + if (getTableTypeName(r.getPrimaryKeyTable()).equals(ref.getContainingType().getName())) return r; + } else if(ref.getOpposite().getName().equals(r.getName())) { + if (getTableTypeName(r.getForeignKeyTable()).equals(ref.getContainingType().getName())) return r; } } throw new RuntimeException("Could not find relationship " + ref.getName() + " in the configuration"); diff --git a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultMetadata.java b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultMetadata.java index 2b3e8b20a6..fdd1845be9 100644 --- a/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultMetadata.java +++ b/java/das/rdb/src/main/java/org/apache/tuscany/das/rdb/graphbuilder/impl/ResultMetadata.java @@ -144,7 +144,7 @@ public final class ResultMetadata { String columnName = (String) i.next(); String pkTableName = columnName.substring(0, columnName.indexOf(idSpell));//_id, _Id, _iD, _ID anything String fkTableName = (String) impliedRelationships.get(columnName); - List pkTableProperties = (List) tableToPropertyMap.get(pkTableName); + List pkTableProperties = (List) tableToPropertyMap.get(configWrapper.getTableTypeName(pkTableName)); if ((pkTableProperties != null) && (pkTableProperties.contains("ID"))) { configWrapper.addImpliedRelationship(pkTableName, fkTableName, columnName); } |