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