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.  [ 5 posts ] 
Author Message
 Post subject: HQL queries
PostPosted: Sat Jan 06, 2007 4:57 pm 
Newbie

Joined: Sat Jan 06, 2007 4:49 pm
Posts: 5
Hi there sure this is really simple for you guys that use this regularly, sorry for such a newbie question.

Im tryin to create a query to return all objectA's based on objectC's Identity

objectA has an instance of objectB assoicated with it
objectC has a collection of objectB's associated with it

objectA objectB objectC

i know you can use a fetch to get all of the objectBs but the rest im lost with!

Thanks

Andy


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 06, 2007 5:46 pm 
Contributor
Contributor

Joined: Sat Sep 24, 2005 11:25 am
Posts: 198
Something like:

from objectA a left join a.B_Instance b
where :c_instnace in elements(b.C_collection)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 06, 2007 6:21 pm 
Newbie

Joined: Sat Jan 06, 2007 4:49 pm
Posts: 5
thanks, but where does the identity i am searchin on go in that?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 06, 2007 8:33 pm 
Contributor
Contributor

Joined: Sat Sep 24, 2005 11:25 am
Posts: 198
you need to pass it in as SetEntity()

if you are talking about the id of C, than it is something like:

from objectA a left join a.B_Instance b left join b.C_Collection c
where c.id = :c_id


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 07, 2007 6:11 am 
Newbie

Joined: Sat Jan 06, 2007 4:49 pm
Posts: 5
sorry if i didnt explain it clearly enough in the origional post but objectB doesnt have the collection

objectC has a collection of objectBs
then objectA has an instance of objectB


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

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.