Mahmoud Saleh
Mahmoud Saleh

Reputation: 33605

using @ManyToMany relationship without @JoinColumn

i just want to know the difference between using @ManyToMany relationship wit @JoinColumn and using it without @JoinColumn

Upvotes: 0

Views: 266

Answers (1)

JB Nizet
JB Nizet

Reputation: 691635

A many-to-many association always needs a join table. A join column is not sufficient: it only enables a one-to-many association.

If you don't specify any @JoinTable annotation on the association, then default values will be used. Hibernate wil use a join table with a default name and default columns composed from the names and IDs of the associated entities.

Upvotes: 3

Related Questions