User类,User之间可以关注,自身映射为@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(name = "t_user_t_followingUser", joinColumns = { @JoinColumn(name = "user_id") },inverseJoinColumns = { @JoinColumn(name = "followingUser_id") })
public List<User> getFollowingUsers() {
return followingUsers;
}public void setFollowingUsers(List<User> followingUsers) {
this.followingUsers = followingUsers;
}@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(name = "t_user_t_followedUser", joinColumns = { @JoinColumn(name = "user_id") }, inverseJoinColumns = { @JoinColumn(name = "followedUser_id") })
public List<User> getFollowedUsers() {
return followedUsers;
}public void setFollowedUsers(List<User> followedUsers) {
this.followedUsers = followedUsers;
}
现在有一个User,查询该User所有的粉丝数量,hql应该如何写啊?