Hopefully, you can help me with the following doubts that I have.

So I have an entity called User that has some columns like Nationality, Gender, Professional Status. And I have an entity for each column referred.

I'm looking for the best way to define this.

Should I apply a ManyToMany relationship between those tables? Since Users can have the same Nationality and Gender?

When I try to implement this, Spring is creating a third table automatically and I don't understand the need.

Having the following shouldn't be enough?:

Table User: id, name, id_nationality. id_gender, id_professional_status

Table Nationality: id, nationality

(etc)

Why Spring is creating another table called user_nationality?

Thanks in advance.


Whenever we are using the ManyToMany relationship in that case a separate table will be created containing both primary keys of the tables involved in the new relationship.