2
我正在与JPA的问题。我试图实现一个数据库,允许用户关注其他用户并被遵循。 我觉得我需要(总结)是这样的:Twitter喜欢JPA的关系
USER_TABLE: id | userName
RELATIONSHIP_TABLE: id | follower | followed | acceptation
我有两个实体(也总结):
@Entity
public class User implements Serializable {
@Id
private Long id;
private String userName;
@OneToMany
private Collection<Relationship> followings;
}
@Entity
public class Relationship implements Serializable {
@Id
private Long id;
private User follower;
private User followed;
private boolean accepted;
}
我的问题是,我不知道这是否是可能做到这一点,因为我获得了更多的表格,我需要的两个表格。
任何人都可以帮助我吗? 感谢和抱歉我的英语。
现在我明白了。非常感谢你。 – 2012-08-26 21:51:09