aspose file tools*
The moose likes Object Relational Mapping and the fly likes can one to one,many-one mapping be using 1 table.only one-many,many-many requires multiple tables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "can one to one,many-one mapping be using 1 table.only one-many,many-many requires multiple tables" Watch "can one to one,many-one mapping be using 1 table.only one-many,many-many requires multiple tables" New topic
Author

can one to one,many-one mapping be using 1 table.only one-many,many-many requires multiple tables

Monica. Shiralkar
Ranch Hand

Joined: Jul 07, 2012
Posts: 644
Please confirm whether my understanding is correct:

one to one mapping: No need for creating more than 1 table. Only in one table it can be shown.
E.g Customer ,Mobile number ........in customer table we can have mobile number.
---One table was involved.

many to one mapping: Again no need for separate tables.just create only 1 table
E.g Customer, Country--------in customer table we can have countryID entry.
---two tables were involved.


one to many: we need separate tables.
E.g Customer,Email.....In Email table we can have customer ID
---2 tables were involved.

many to many: we need separate tables.


So is my conclusion correct that one to one can be shown using just 1 table.but one to many and many to many and many to one can requires separate tables.

thanks

Volodymyr Levytskyi
Ranch Hand

Joined: Mar 29, 2012
Posts: 505
    
    1

Hello !

In my understanding mapping is linking two or more tables via foreign and primary keys.
One-to-one means link one primary key in one table to one foreign key in another table.
One-to-many means link one primary key in one table to many foreign keys in another table.
Many-to-one link many foreign keys to one primary key.

To understand all this it is beter to see it once in action!

True person is moral, false is right!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can one to one,many-one mapping be using 1 table.only one-many,many-many requires multiple tables