The Bank sample uses a one-to-many relationship for the VapBankBranch and the VapAccount business objects. This topic explains how to create a one-to-many relationship using the ObjectExtender tools.
Do the following:
The BankBranch-Account class association is an example of a one-to-many relationship.
It was created as follows:
This launches the Association Editor.
This means VapBankBranch can be obtained from the VapAccount object.
This means VapAccount can be obtained from the VapBankBranch object.
Select Many. This sets the cardinality to zero-to-many (0:M). If a cardinality of one-to-many (1:M) is desired, select Required.
You are now done with the Model Browser. The one-to-many relationship is defined.
Next, defining this relationship using schema semantics is shown. Finally, mapping the schema to the model is the last step for completing the persistence layer.
Do the following:
The account-branch foreign key relationship is the one-to-many relationship that corresponds to the BankBranch-Account class association (relationship).
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 ACCOUNT table which corresponds to the branch, BRANCHNO.
You are now done with the Schema Browser.
The last step in defining the persistence layer for the one-to-many relationship follows.
The (r) accounts(account-branch) property map represents the mapping from the accounts attribute from VapBankBranch to the account-branch foreign key relationship.
It was created as follows.
This launches the Property Map Editor.
This concludes the persistence layer for the one-to-many relationship.