Thank you very much,
I have successfully implemented this with a flattened relationship and
was pleasantly surprised as to how easy it is to do! :)
I do require, in another join, to store information in the join. In
this instance, do I need to treat them as two separate
relationships: Whereas before I add and relate the objects using
entityA.addObjectToBothSidesOfRelationshipWithKey(entityB,
"entityBs"); and access them all using entityA.entityBs();, will I now
need to access them via the join and manage both relationships
manually? e.g. access: entityA.joinEntities.entityB();
Thanks and kindest regards,
-- Tim
On 6 Feb 2009, at 12:14, Lachlan Deck wrote:
Hi Tim,
On 06/02/2009, at 10:26 PM, Tim Kitchener wrote:
<...>would really appreciate it if you could take the time to
produce me an idiots'-guide to set this up.
The scenario that I need to model for our current project requires
many-to-many relationship between my entities.
The easiest way to achieve this is:
- open the model in WOLips entity modeler
- create Entity A and Entity B with their relative attributes and
relationships (except for the relationship to each other)
- select the two entities
- ctl click and select Create Relationship.
- in the wizard that appears have both sides as a toMany. This will
auto-create a join entity for you with the relevant relationships
from and to each entity.
- generate sql
This will create flattened relationships between the two outer
entities by default such that you don't think about the join entity
- it's just a db artifact in the background. If, however, you need
to store additional information in the join then you simply have a
toMany from Entity A to the join, a toMany from Entity B to the join
and toOne relationships from the join to A and B. Just untick
flatten relationships.
<Picture 11.png><Picture 12.png>
with regards,
--
Lachlan Deck
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]