-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Help expressing a grouped join
PostPosted: Tue May 29, 2012 5:35 pm 
Pro
Pro

Joined: Wed Nov 05, 2003 7:22 pm
Posts: 211
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.