// Add the source foreign key fields to the mapping.
for (MetadataPrimaryKeyJoinColumn primaryKeyJoinColumn : primaryKeyJoinColumns) {
// The default primary key name is the primary key field name of the
// referenced entity.
DatabaseField pkField = primaryKeyJoinColumn.getPrimaryKeyField();
pkField.setName(getName(pkField, referenceDescriptor.getPrimaryKeyFieldName(), m_logger.PK_COLUMN));
// The default foreign key name is the primary key of the
// referencing entity.
DatabaseField fkField = primaryKeyJoinColumn.getForeignKeyField();
fkField.setName(getName(fkField, m_descriptor.getPrimaryKeyFieldName(), m_logger.FK_COLUMN));
// Add a source foreign key to the mapping.
mapping.addForeignKeyField(fkField, pkField);
// Mark the mapping read only