-->
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: Filter a list of records indirectly ref. from another table
PostPosted: Thu Aug 06, 2009 10:36 am 
Newbie

Joined: Thu Aug 06, 2009 10:32 am
Posts: 1
Hi,

I have 3 tables A, B and C, where each C record references
exactly one A and one B. Given a list of B IDs, I would like to
get all the A objects for which its exists at least one C which
references both that A and one of the given B IDs.

For instance, given the following database:

Code:
    A1 A2 A3
    B1 B2 B3
    C1(A1,B1) C2(A2,B2), C3(A3,B1)
    # note C3 references B1


if I have the ID list is just "B1", I'd like to get the A objects
A1 and A3 (because both C1 and C3 refer to B1, and in turn they
refer to A1 and A3.)

Is it possible with Criterion objects, or with HQL?

Regards,

--
Florent Georges
http://www.fgeorges.org/


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.