Initializing one-to-many association relation with named Objects
This document applies only to the following language version(s):
How to initialize one to many association relation with named Objects
When having a class related to an array of n objects through an association with multiplicity n, where n=1,2,3... , Rhapsody automatically initializes them under the initRelation().
However, considering a model having named objects instead of array of objects, Rhapsody does not initialize them because it cannot know which relation to initialize with which object.This is up to you to initialize them the way you desire.
There are two ways you can initialize these relations :
- Create separate associations and links to each of the named Objects. (See attached screenshot : UsingSeparateLinks.JPG)
- Manually add the initialization code inside the constructor. (See attached screenshot : ExplicitInitialization.JPG)