// Add the mapping to the descriptor.
m_descriptor.addMapping(mapping);
} else {
// Create a 1-M mapping and process common collection mapping
// metadata.
OneToManyMapping mapping = new OneToManyMapping();
process(mapping);
// Non-owning side, process the foreign keys from the owner.
OneToOneMapping ownerMapping = null;
if (getOwningMapping().isOneToOneMapping()){
ownerMapping = (OneToOneMapping) getOwningMapping();
} else {
// If improper mapping encountered, throw an exception.
getValidator().throwInvalidMappingEncountered(getJavaClass(), getReferenceClass());
}
Map<DatabaseField, DatabaseField> keys = ownerMapping.getSourceToTargetKeyFields();
for (DatabaseField fkField : keys.keySet()) {
mapping.addTargetForeignKeyField(fkField, keys.get(fkField));
}
// Add the mapping to the descriptor.
m_descriptor.addMapping(mapping);
}