Compositions

A composition, also called a composition association, indicates a relationship between two business entities, but the entities are not independent. For example, the following composition shows the relationship between the Timecard entity and the Day entity.

[spacer]

The lifetime of the child entity is controlled by the parent entity. For instance, the child entity is retrieved when the parent entity is retrieved. In the previous example, any Day entities associated with a specific Timecard entity are retrieved only when the Timecard entity is retrieved.

The following types of compositions are supported:

One-to-one composition   An entity is associated to at most one instance of another entity. The target end of the composition will have a multiplicity of 1 or 0..1 for this type of composition association.

One-to-many compositions   An entity is associated with a collection of one or more instances of another entity. The target end of the composition will have a multiplicity of * or 0..* for this type of composition association.

Using compositions

Compositions are less frequently used in Business Portal integrations. When they are, it is usually the case when a single entity has a corresponding set of items. An example would be an invoice and the corresponding set of line items. The invoice would be modeled as an entity, with a composition relationship to a line item entity.

If you have scrolling windows with line items in your application that integrates with Great Plains or Solomon, you may have a set of entities that should be modeled with a composition relationship.

You can’t create a composition relationship to existing Great Plains or Solomon entities. You can create composition relationships only to your own integration’s entities.


Creating a composition

Use the following procedure to create a composition relationship between two business entities.

  1. Draw the composition association.

Using the Composition Association tool in XDE, draw a composition association from the base (parent) entity to the target (child) entity.

  1. Specify the composition visibility.

With the composition association selected, view the End1 properties for the composition association. To make the composition visible from code, set the End1Visiblity property to PUBLIC.

  1. Specify the multiplicity.

Set the End1Multiplicy property to a value appropriate for the composition association:

[spacer]

Multiplicity

Description

0..1

Indicates zero or one associated entity.

1

Indicates exactly one associated entity.

1..*

Indicates one or more associated entities. This indicates a collection of associated entities.

*

Indicates any number of associated entities, including none. This indicates a collection of associated entities.


  1. Specify the role name.

Set the End1Name property to a value that indicates the entity or collection of entities that the composition association represents.

  1. Specify the Hypermedia navigation (optional).

By default, the Hypermedia navigation is allowed in both directions for a composition association. If you want to restrict the Hypermedia navigation in a specific direction, set the HypermediaNavigable property to False for that end of the association.

Show: