|Re: How to work with many-to-many entity relations? [message #981113 is a reply to message #977737]
||Mon, 12 November 2012 06:56
| Jeremie Bresson
Registered: November 2010
If I may add a more complex example:
In an outline-based application, you will represent your entities in a tree. A tree is suitable for one to many relations: when you expand one node, you see all related entities.
Lets take this database as example (Source: Oracle MySQL - Sakila)
As you see, you have a many to many relation between films and categories and between films and actors.
When you have fixed one category (resp. one actor), you have many film that belongs to this category (resp.to this actor). A possibility is to add a FilmsTablePage as child page of the CategoriesTablePage (resp. of the ActorsTablePage). In this FilmsTablePage you load only the films that belong to the category (resp. the actor) corresponding to the row in the parent table page.
You get something like this for categories:
And something like this for actors:
This is comparable to:
MiniCRM Tutorial - Write the second page
Now consider the films: for one film, there is many categories and many actors.
A solution is to add a node page for each film. This page contains two table page (one for category and one for actor).
See: MiniCRM Tutorial - Reorganize the tree.
To summarize here the pages tree:
├─Films Table Page
│ └─Film Node Page
│ ├─Actors Table Page
│ └─Categories Table Page
├─Categories Table Page
│ └─Films Table Page
└─Actors Table Page
└─Films Node Page
Do not hesitate to ask question on the forum.
[Updated on: Mon, 12 November 2012 06:57]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.03111 seconds