You can create associations between business objects. Association of business object nodes is a way to specify model-level dependency between two business object nodes. At runtime this is implemented as a relation between the master tables of the two business objects nodes. The association gives you a way to retrieve related business object node instances of a particular business object node. Once you model an association in Composite Application Explorer and generate the code, there is a set of methods ( set(), get(), add() and remove() ) available in the business object nodes service interface to manage this association at runtime. Another way to use association is to model findBy operations that involve attributes of the associated business object nodes.
Choose with the quick info text Add Association.
You can change the values of the Nameand Cardinalityfields for the target business object node on its Associationstab page.
CAF automatically creates associations for both source and target business object nodes in the Composite Application Explorerview.
If the parent business object node is deleted, the child business object node is deleted as well. To create a parent-child association, in the Composite Application Explorer, click the node of the business object and choose New BO Node. Choose the newly created business object node and choose with the quick info text Add Association.
This way, if you delete the source business object, the target business object node of the association is not deleted. To create a cross-business object node association, choose a business object node with a different root node and choose with the quick info text Add Association.
The business object node hasas a new association.
To remove an association, select it and choose with the quick info text Delete Association.
You may have a business object node named Department that has an association to another business object node Employee. Then you can set the cardinality to be NONE_TO_MANY (that implies a collection) and you can get all the employees that currently work in a particular department. Three tables are generated at runtime - two for business object nodes and one table for the multiple association between them.