*/
protected void processOneToManyMapping() {
// Non-owning side, process the foreign keys from the owner.
DatabaseMapping owningMapping = getOwningMappingAccessor();
if (owningMapping.isOneToOneMapping()){
OneToOneMapping ownerMapping = (OneToOneMapping) owningMapping;
// If the owner uses a relation table mechanism we must map a M-M.
if (ownerMapping.hasRelationTableMechanism()) {
ManyToManyMapping mapping = new ManyToManyMapping();
// Process the common collection mapping.
process(mapping);
// Process the mapped by relation table metadata.
processMappedByRelationTable(ownerMapping.getRelationTableMechanism(), mapping.getRelationTableMechanism());
// Set the mapping to read only
mapping.setIsReadOnly(true);
} else {
// Create a 1-M mapping and process common collection mapping
// metadata first followed by specific metadata.
OneToManyMapping mapping = new OneToManyMapping();
process(mapping);
Map<DatabaseField, DatabaseField> keys = ownerMapping.getSourceToTargetKeyFields();
for (DatabaseField fkField : keys.keySet()) {
DatabaseField pkField = keys.get(fkField);
// If we are within a table per class strategy we have to update
// the primary key field to point to our own database table.