@JoinTable to join three tables

Viewed 1791

How can I use @JoinTable to join three tables?

I have three tables:

user:
id, name 

post:
id, date

company:
id, name

I want to create a new table with the following columns:

user_id, post_id, company_id.

I used:

@JoinTable(name = "new_table", joinColumns = @JoinColumn(name = "user_id"),
    inverseJoinColumns = @JoinColumn(name = "post_id"))

However, I am not sure how to add the third column.

1 Answers
Related