• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Mapping of E/R Diagram to Tables

 
Ranch Hand
Posts: 38
Eclipse IDE Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Ranchers,

While mapping one to many relation ship between entities to tables , each of the entities gets mapped to separate table. The tables are linked to each other with the help of referential foreign key constraint. This is the normal approach one follows.

My doubt is , Is it recommended to map both the entities to a single table ?. Kindly let me know the correct approach.

Regards,
Anil
 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Each entity would map to one table. So in case of one-many mapping the entity having the many property would have a key to identify a unique row in the other entity.

Both the entities mapped to same table would be- repetition of the data which was supposed to be appearing once, but appears many times due to its relation with the other entity. This is usually a wrong approach. Moreover you are combining two different things which can lead to a unnecessarily coupled tables.
 
Anil Kumar
Ranch Hand
Posts: 38
Eclipse IDE Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for clearing my doubt
 
He was expelled for perverse baking experiments. This tiny ad is a model student:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic