Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

what is the relationship?

 
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Customer 0..1 ------ 0..* Address
This syntax always confuses me.
This is bidirectional ? "0...1" what is meaning, why has "0" there?
Anybody can help me? Thanks.
Edward
 
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my opinion,
This is a bidirectional. and
0..1 is means Customer may be have Adddress more than one or not have address)
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Customer 0..1 ------ 0..* Address
means that
  • One customer might have several addresses (private, professional, etc) or none at all
  • One address usually belongs to at most one customer (i.e., it is not possible for two different customers to live at the same address)


  • This relationship is debatable as several people can live at the same address. For instance, each member of a family can be a customer and they all live at the same address. The above relationship would not be appropriate for modeling such a case. Instead, the following one can be used:
    Customer 0..* ------ 0..* Address
    There are two more things we could consider here. First, it is usually the case that a customer necessarly has an address without which it could not have been registered as a customer. In order to consider this, the relationship would have to be modeled as follows:
    Customer 0..* ------ 1..* Address
    or
    Customer 0..* ------ + Address
    The second thing is that it doesn't make much sense too have an address in a database that does not belong to at least one customer. Why would a retail store keep an address in its database from which no booking will ever come? Building on this, we can refactor the relationship to the following:
    Customer 1..* ------ + Address
    or
    Customer + ------ + Address
    The relationship now reads:
  • One customer has at least one address
  • One address usually belongs to at least one customer (i.e., two different customers may live at the same address)


  • [ March 08, 2004: Message edited by: Valentin Crettaz ]
     
    We should throw him a surprise party. It will cheer him up. We can use this tiny ad:
    Devious Experiments for a Truly Passive Greenhouse!
    https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
      Bookmark Topic Watch Topic
    • New Topic