Hi,
I need to produce a hql query that selects all the Posts in a group that have a reply and send the relevant posts to all the members that have participated in those discussions.
Can anyone do some suggestions about an efficient way to achieve this query? I was thinking of grouping the selecting result by user, but I'm not really sure about the best way to do this with a comment.user and a post.user.
My setup
Code:
public class Post{
@ManyToOne
Group group;
@OneToMany
Set<Comment> comments;
@ManyToOne
User user;
@Column
String comment;
}
Public class Comment{
@ManyToOne
Post post;
@ManyToOne
User user;
@Column
String comment;
}
public class Group{
@OneToMany
Set<GroupMember> members;
}
public class GroupMember{
@ManyToOne
Group group;
@ManyToOne
User user;
}
Marc