if (primaryKeyJoinColumns.isEmpty()) {
if (getDescriptor().hasCompositePrimaryKey()) {
// Add a default one for each part of the composite primary
// key. Foreign and primary key to have the same name.
for (DatabaseField primaryKeyField : getDescriptor().getPrimaryKeyFields()) {
PrimaryKeyJoinColumnMetadata primaryKeyJoinColumn = new PrimaryKeyJoinColumnMetadata(this.m_project);
primaryKeyJoinColumn.setReferencedColumnName(primaryKeyField.getName());
primaryKeyJoinColumn.setName(primaryKeyField.getName());
primaryKeyJoinColumns.add(primaryKeyJoinColumn);
}
} else {
// Add a default one for the single case, not setting any
// foreign and primary key names. They will default based
// on which accessor is using them.
primaryKeyJoinColumns.add(new PrimaryKeyJoinColumnMetadata(this.m_project));
}
}
if (getDescriptor().hasCompositePrimaryKey()) {
// All the primary and foreign key field names should be specified.