Specifying the intermediate table name in JPA OneToMany relationship

Viewed 10195

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?

1 Answers
Related