checkSchemaNames(parentColumns);
checkTableNames(childColumns);
checkSchemaNames(childColumns);
Relationship r = FACTORY.createRelationship();
//JIRA-952
if(this.config.isDatabaseSchemaNameSupported()){
r.setName(((QualifiedColumn)childColumns.get(0)).getSchemaName()+"."
+((QualifiedColumn)childColumns.get(0)).getTableName());
r.setPrimaryKeyTable(((QualifiedColumn)parentColumns.get(0)).getSchemaName()+"."
+((QualifiedColumn)parentColumns.get(0)).getTableName());
r.setForeignKeyTable(((QualifiedColumn)childColumns.get(0)).getSchemaName()+"."
+((QualifiedColumn)childColumns.get(0)).getTableName());
}
else{
r.setName(((QualifiedColumn)childColumns.get(0)).getTableName());
r.setPrimaryKeyTable(((QualifiedColumn)parentColumns.get(0)).getTableName());
r.setForeignKeyTable(((QualifiedColumn)childColumns.get(0)).getTableName());
}
if (this.logger.isDebugEnabled()) {
this.logger.debug("Created relationship from " + r.getPrimaryKeyTable()
+ " to " + r.getForeignKeyTable() + " named " + r.getName());
}
KeyPair pair = null;
for(int i=0; i<parentColumns.size(); i++){
pair = FACTORY.createKeyPair();
pair.setPrimaryKeyColumn(((QualifiedColumn)parentColumns.get(i)).getColumnName());
pair.setForeignKeyColumn(((QualifiedColumn)childColumns.get(i)).getColumnName());
r.getKeyPair().add(pair);
}
r.setMany(true);
config.getRelationship().add(r);
return r;
}