0

I recently appeared for an interview and interviewer asked me that if there are two objects - Body and parts, relation is one to many between body and parts.He asked why would we implement one to many relation as many to many when it comes to Hibernate?

I do not know if that's true.If its true, why do we do that?

C4CodeE4Exe
  • 3,840
  • 8
  • 39
  • 46
  • 1
    We wouldn't, otherwise it would be a many-to-many association, and not a one-to-many association anymore. This question doesn't make much sense. If the question was "why would we use a join table instead of a join column to map a one-to-many association", then it would start making sense. – JB Nizet Apr 05 '15 at 15:32
  • @JBNizet Thanks, that means it was a trap, found answer for the second one http://stackoverflow.com/questions/1378248/one-to-many-relationship-with-join-table – C4CodeE4Exe Apr 05 '15 at 15:44

0 Answers0