12. Working with Related Data

PROBLEM

When working with domain object that has a relationship to another domain object, there needs to be way of programmaticaly accessing the related data.

SOLUTION

Related data can be programatically read and manipulated using the defined relationship name. Depending on the nature of the relationship (one-to-one, one-to-many, many-to-many), the mechanism for accessing the data will be slightly different.

HOW IT WORKS

In the Author and Book example from the Defining Relationships recipe, an author's set of related books can be searched using the Search Collection Step and iterated using the Iterate Step. The related data is accessed using the relationship (i.e. currentAuthor.books).