【发布时间】:2014-08-16 06:32:13
【问题描述】:
我正在创建一种社交网络,并且我的用户可以关注其他用户。所以我有一个像这样的实体:
@Entity
public class FollowedUser{
@ManyToOne
private User user;
@ManyToOne
private User followedUser;
//more fields
...
}
我不能有 ManyToMany 关系,因为我的 FollowedUser 实体中有更多字段。现在,我的问题是:
【问题讨论】:
标签: jpa many-to-many unique-index surrogate-key compound-key