buildForeignKeyHeader(cd.getFullTableName(), buffer);
for (int i = 0; i < keys.length; i++) {
String columnName = (String) keys[i];
FieldDescriptor foreignColumn = cd.getPkFields()[i];
String foreignColumnName = foreignColumn.getPersistentField().getName();
buildReferenceForColumn(buffer, columnName, foreignColumnName);
FieldDescriptor fieldDescriptor = (FieldDescriptor)foreignColumn.clone();
fieldDescriptor.setColumnName(columnName);
columns.add(fieldDescriptor);
}
buffer.append(" </foreign-key>\n");
addReferenceToTable(collectionDescriptor.getIndirectionTable(), buffer.toString());