Solved

many-many relationship

Posted on 2011-09-06
3
209 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 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …

776 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