Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

many-many relationship

Posted on 2011-09-06
3
Medium Priority
?
231 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
  • 2
3 Comments
 
LVL 47

Accepted Solution

by:
for_yan earned 1000 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 1000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

772 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