10

I have a table user and each user has a set of other users as friends. the way I defined it in my model class is as following:

     Public class User extends Models {
     ....
     @OneToMany
     public List<User> friends;
     .
     .
     }

Now the Play JPA is creating an intermediate table name user_user with following fields.

    mysql> desc user_user;
    ------------+------------+------+-----+---------+-------+
    | user_id     | bigint(20) | NO   | MUL | NULL    |       |
    | friends_id  | bigint(20) | NO   | PRI | NULL    | 

Question is how can i change the name of the intermediate table (user_user) and columns in it?

nightograph
  • 2,179
  • 5
  • 31
  • 49

1 Answers1

13

Using the @JoinTable annotation should give you what you need. There is a good post ( JPA "@JoinTable" annotation ) specifically on how to use this annotation.

Community
  • 1
  • 1
Codemwnci
  • 54,176
  • 10
  • 96
  • 129