}
MappingWrapper wrapper = getConfigWrapper();
Iterator i = getRelationships().iterator();
while (i.hasNext()) {
Relationship r = (Relationship) i.next();
String parentName = wrapper.getTableTypeName(r.getPrimaryKeyTable());
String childName = wrapper.getTableTypeName(r.getForeignKeyTable());
if (parentName == null) {
throw new RuntimeException("The parent table (" + r.getPrimaryKeyTable()
+ ") in relationship " + r.getName()
+ " was not found in the mapping information.");
} else if (childName == null) {
throw new RuntimeException("The child table (" + r.getForeignKeyTable()
+ ") in relationship " + r.getName()
+ " was not found in the mapping information.");
}
Property parentProperty = root.getProperty(parentName);
Property childProperty = root.getProperty(childName);
if (parentProperty == null) {
throw new RuntimeException("The parent table (" + parentName + ") in relationship "
+ r.getName() + " was not found.");
} else if (childProperty == null) {
throw new RuntimeException("The child table (" + childName + ") in relationship "
+ r.getName() + " was not found.");
}
Type parent = parentProperty.getType();
Type child = childProperty.getType();
Property parentProp = SDOUtil.createProperty(parent, r.getName(), child);
Property childProp = SDOUtil.createProperty(child, r.getName() + "_opposite", parent);
SDOUtil.setOpposite(parentProp, childProp);
SDOUtil.setOpposite(childProp, parentProp);
SDOUtil.setMany(parentProp, r.isMany());
}
this.rootType = root;
}