-->
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.  [ 3 posts ] 
Author Message
 Post subject: HQL: matching collection
PostPosted: Fri Aug 13, 2004 10:16 am 
Beginner
Beginner

Joined: Wed Jul 14, 2004 11:51 am
Posts: 43
Hello,

I have a simple HQL question. I wish to build a query that will allow me to look for a child collection.

For example, I have a collection of kittens and wish to test which cats have these kittens.

I would like to be able to do something like this:

Code:
           String query = "select cat from Cat as cat join cat.kittens as kittens where kittens = " + cat.getKittens()");


How can I do this? Or is there another way?

Thank you

PS: if you also have an idea on how to do this in Criteria form, I'd be happy to know how


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 13, 2004 12:52 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
select kitten.cat from Kitten kitten where kitten = ???
this is easy but you need bidirectionnal one-to-many

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 17, 2004 9:16 am 
Beginner
Beginner

Joined: Wed Jul 14, 2004 11:51 am
Posts: 43
Thanks for your reply,

Unforturately, I don't think you understood my problem. I have a Collection of Kittens and wish to match Cats that possess exactly those kittens.

For example, I have the Following Kittens (kit1, kit2, kit3). I want to match a Cat that has a child collection of exactly these 3 kittens (no more no less).

Thank you,

Fran


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