The Bank sample uses a many-to-many relationship for the VapBrankBranch and the VapCurrency business objects. With the current ObjectExtender implementation, you must construct a many-to-many relationship by joining together two one-to-many relationships: VapBankBranch-to-VapBranchToCurrency and VapCurrency-to-VapBranchToCurrency. This topic explains how to create a many-to-many relationship using the ObjectExtender tools.
Do the following:
The bc to branch plus the bc to currency class associations is an example of a many-to-many relationship (As mentioned, the current implementation for a many-to-many relationship is to create two one-to-many relationships).
It was created as follows:
This launches the Association Editor.
This means a VapBankBranch business object can be obtained from a VapBranchToCurrency business object. .
This means a VapAccount business object can be obtained from a VapBankBranch business object.
This sets a cardinality of zero-to-many (0:M). If a cardinality of one-to-many (1:M) is desired, select Required.
Next, you define the second of the two one-to-many relationships.
Do the following:
This launches the Association Editor.
This means a VapBankBranchToCurrency business object can be obtained from a VapCurrency business object. .
This means a VapCurrency business object can be obtained from a VapBankToCurrency business object.
This sets a cardinality of (1:1).
You are now done with the Model Browser. The many-to-many relationship is defined.
Next, defining this relationship using schema semantics is shown. Mapping the schema to the model will be the last step covered. These combined tasks provide the required information for creating persistence support for your business objects.
Do the following:
The bc-branch and bc-currencyforeign key relationship is the many-to-many relationship that corresponds to the bc-to-branch and bc-to-currency class associations.
It was created as follows.
This launches the Foreign Key Relationship editor.
The Primary key column (read-only) will be updated with the primary key from the table.
In the Foreign key column, select the foreign key in the BRNCHCURR table which corresponds to the branch, BRANCH.
Next, you will define the bc-currency side of the foreign key relationship.
Do the following:
This launches the Foreign Key Relationship editor.
The Primary key column (read-only) will be updated with the primary key from the table.
In the Foreign key column, select the foreign key in the BRNCHCURR table which corresponds to the currency, TYPE.
You are now done with the Schema Browser.
The last step in defining the persistence layer for the many-to-many relationship follows.
The (r) branch (bc-branch) property map represents the mapping from the currency attribute from VapBranchToCurrency to the bc-currency foreign key relationship.
It was created as follows.
This launches the Property Map Editor.
This concludes defining the persistence layer for the many-to-many relationship.