wood burning stoves 2.0
The moose likes JDBC and Relational Databases and the fly likes Mapping of E/R Diagram to Tables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Mapping of E/R Diagram to Tables" Watch "Mapping of E/R Diagram to Tables" New topic

Mapping of E/R Diagram to Tables

Anil Kumar
Ranch Hand

Joined: Nov 16, 2008
Posts: 38

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.

Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3151

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.

Mohamed Sanaulla | My Blog
Anil Kumar
Ranch Hand

Joined: Nov 16, 2008
Posts: 38

Thanks for clearing my doubt
I agree. Here's the link: http://aspose.com/file-tools
subject: Mapping of E/R Diagram to Tables
It's not a secret anymore!