Tuesday, 24 July 2012

Creating a Many-to-Many Relationship

- For our recruiting app, we're going to create a junction object called Job Posting.
- A job posting fits into the space between positions and employment websites
- one position can be posted many times, and one employment website can have many job postings.
- But a job posting always represents a posting about a single position on a single employment website. 
- In essence, the Job Posting object has a many-to-one relationship with both the Position and the Employment Website objects.
- And through those many-to-one relationships, we'll have a many-to-many relationship between the Position and Employment Website objects.

- In many apps, the sole purpose of a junction object is to simply relate two objects.
- So it often makes sense to give the junction object a name that indicates the association
or relationship it creates.
- For example, if you wanted to use a junction object to create a many-to-many relationship between bugs and cases, you could name the junction object BugCaseAssociation.

No comments:

Post a Comment