-->
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: Multiple association on same entity with hibernate Criteria
PostPosted: Tue Oct 21, 2014 9:06 am 
Newbie

Joined: Tue Oct 21, 2014 8:59 am
Posts: 1
Hi all ! :)

I want to use this query in criteria

Code:
SELECT a.a_id, b.b_id, b.b_description, sum(c1.c_score) AS score1, sum(c2.c_score) AS score2
FROM b, a, d, c

LEFT OUTER JOIN c AS c1 ON c1.c_id = c.c_id AND c1.c_comment = 'good'
LEFT OUTER JOIN c AS c2 ON c2.c_id = c.c_id AND c2.c_comment = 'nogood'

WHERE b.b_Id = d.d_id
AND d.d_id = c.c_id
AND c.c_foreignkey_a_id = a.a_id

GROUP BY a.a_id, b.b_id, b.b_description

My problem, in this case, is the 2 associations on the same entity ( C => C1 / C => C2).

And I want to know if there is a way to do this with criteria ?


Thanks ! - XP


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.