-->
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.  [ 4 posts ] 
Author Message
 Post subject: Querying Many-to-one relationships
PostPosted: Mon Apr 19, 2004 11:10 pm 
Newbie

Joined: Tue Mar 09, 2004 8:52 pm
Posts: 5
Assume a user has a collection of address objects and each address object has a state object.

I want to identify all users who has an address in a given state.

I've searched the forums and documentation, but haven't found an example of such a query.

How would I do this using HQL (preferably in one query)?

Thanks for the help.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 19, 2004 11:13 pm 
Newbie

Joined: Mon Apr 19, 2004 7:10 pm
Posts: 7
I think you are asking a question similar to mine in the following post:

http://forum.hibernate.org/viewtopic.php?t=930074


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 20, 2004 9:49 am 
Newbie

Joined: Tue Mar 09, 2004 8:52 pm
Posts: 5
Perfect. Thanks for the quick reply.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 20, 2004 12:39 pm 
Beginner
Beginner

Joined: Tue Apr 20, 2004 12:07 pm
Posts: 21
Something like

select user from User, Address as address, State as state where
address in elements(user.addresses) and address.state = ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.