IBM Support

Initializing one-to-many association relation with named Objects

Technote (FAQ)


This document applies only to the following language version(s):

English

Question

How to initialize one to many association relation with named Objects

Answer

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)


UsingSeparateLinks.JPGExplicitInitialization.JPG

Document information

More support for: Rational Rhapsody
General Information

Software version: 7.5, 7.5.0.1

Operating system(s): Windows

Reference #: 1405221

Modified date: 27 October 2010