Solved

many-many relationship

Posted on 2011-09-06
3
226 Views
Last Modified: 2012-05-12
I was trying to understand about many-many relationship. Say many customers have many phone numbers. How does it impact single customer. Like Single customer always have many phones(like home phone, mobile phone, office phone number etc ). Then that becomes one-many relationship right not many-many. Thanks in advance
0
Comment
Question by:gudii9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 47

Accepted Solution

by:
for_yan earned 250 total points
ID: 36492745

check example this example:

say one stock can belong to many categories - say commodities, big company

and one category cabn conating many duifferent stocks

look at details here:


http://www.mkyong.com/hibernate/hibernate-many-to-many-relationship-example/
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 250 total points
ID: 36493871
>>
Like Single customer always have many phones(like home phone, mobile phone, office phone number etc ). Then that becomes one-many relationship right not many-many.
>>

When you think about N-N relationships, it's helpful to think of database use cases.
In a situation like you mention above (customer, phones and many-many), the following use cases spring to mind:

1. Given a customer, find their phone number(s)
2. Given a phone number, find to which customer(s) it belongs

The second one is made possible by many to many. Phone number X could belong to customers Y or Z, because Y and Z live at the same address
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 36585704
?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question