Jim
You are trying to create a many-to-many relationship between Company and Opportunity.
In EOModeler, under the graphic diagram view, select both entities. Then select the Property menu choice, and select the Join in Many-to-Many sub choice. This will create the Opportunity_Company table for you, but it will not have any external table name nor attribute in it. You will need to add them. However, the more important thing is that EOModeler would have created for you six relationships in the three Entities.
In the Opportunity_Company table there will be company and opportunity to-one relationships to the parent entities respectively.
In the Company table (entity) there will be <b>opportunitys</b> and opportunityCompanys relationship. The <b>opportunitys</b> relationship is the FLATTENED relationship. It is based on the opportunityCompanys. It is shown in Bold Black and an class attribute. The opportunityCompanys relationship is the "real" relationship, but not a class attribute.
The same is true in the Opportunity table (entity).
The flattened relationship allows you to say aCompany.opportunites() to get the list of opportunities back, instead of going to the opportunityCompanys table then asking for the opportunities() from there.
And the company.addObjectToBothSidesOfRelationshipWithKey( newOpportunity, "opportunitys" ) would automatically create the association record in the Opportunity_Company table.
This only works if you don't have any additional attributes to capture in the Opportunity_Company table, e.g. start_date, end_date, etc.
If you have these additional attributes then it is another story....
Paul
thanks art.
what's flattened relationships? i can't catch wat the WO tutorial is talking abt. when do i use flattened and when do i not use? any pros and cons?
Warmest Regards,
Jim Wong