-->
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: Using contains for collections with HSQL?
PostPosted: Thu Jan 22, 2004 1:58 pm 
Beginner
Beginner

Joined: Wed Dec 03, 2003 2:43 pm
Posts: 22
Hi,

Say I have a Cat object which has a one to many collection Kittens such that myCat.getKittens() returns a collection of Kitten objects.

If there is a method Kitten.getName(), how might one, say, select all Cats which have Kittens of name Fred? I am envisioning something like:

"Select Cat from cats as cat where cat.kittens.contains(kitten.name='Fred')"

(I know my HSQL is bad and the query I invented is silly but hopefully it gets the point across :) )

Thanks for the info,
Gabe


Top
 Profile  
 
 Post subject: Slight change...
PostPosted: Thu Jan 22, 2004 3:05 pm 
Beginner
Beginner

Joined: Wed Dec 03, 2003 2:43 pm
Posts: 22
My apologies...

I am wondering how to do this for a many to many Collection relationship not one to many. (Where a Cat has many kittens and a kitten may have multiple cats.)

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 22, 2004 5:29 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
"Select cat from Cat as cat join cat.kittens as kitten where kitten.name = 'Fred'" might work


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.