0

I want to create a 2 tables where one will have user info and other list of authorities that user has on a site.I want to use join table to connect them. enter image description here

I want authorities table to just have 2 constants "ROLE_USER" and "ROLE_ADMIN" so that in "user_authority" table in "authority_id" column every user would either have either 1 or 2 depending on a role id,but what i don't know is how to configure entity relationship so that when i add user he is connected to that authority id.

Djordje Vuckovic
  • 383
  • 1
  • 5
  • 11
  • 1
    Does this answer your question? [Spring Boot - Loading Initial Data](https://stackoverflow.com/questions/38040572/spring-boot-loading-initial-data) – Jens Schauder Jan 03 '20 at 06:15

1 Answers1

0

That's called ManyToMany relation. It uses an intermediate table with two ids exactly per your descriprion. Sample guide ManyToMany guidance

dimirsen Z
  • 873
  • 13
  • 16