Many-to-many

A type of relationship between entities of types A and B which associates a list of entities of type B to an entity of type A and vice versa

One-to-many

One-to-many is relationship between two different object properties.



Parent instead associations

Example

"Just an advice since you separate mother and father from parent i think you d better avoid a many-to-many relationship;instead a one-to-many relationship seems better"

from question  

Schema two-to-many relation (e.g. Child with Mother and Father)

"Using two one-to-many associations is always better than relying on many-to-many relations"

from question  

How to join tables on non Primary Key using JPA and Hibernate

Others

Example

Iâ ve read a so questionâ s comment where inserting order# 68 as pictured wouldnâ t cause any trouble but if i wanted to query orders by certain tags a many-to-many is more appropriate convenient efficient since otherwise in a one-to-many every single order will have to be checked to know how its tags is this true

from question  

What are the consequences of violating a one-to-many relationship & when to use a many-to-many?

Back to Home
Data comes from Stack Exchange with CC-BY-SA-4.0