-->
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: select by size of a collection property
PostPosted: Sat Nov 29, 2003 9:18 pm 
Beginner
Beginner

Joined: Wed Sep 17, 2003 10:25 am
Posts: 36
I am trying to do a select based on the size of a collection of collections property. For example, I have a ClassA that has a one-to-many relationship with ClassB. And class B has a one-to-many relationship with ClassC.

What I want to do is the following

from ClassA c where c.myClassBs.classBsCcollection.size>1.

So, I want all ClassA instances where the size of the Set property of ClassC is > 1. I looked at using at elements, but that is not working.

Anyone have any ideas?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 29, 2003 9:38 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Code:
from ClassA c join c.myClassBs b
where b.classBsCcollection.size>1



or simply:

Code:
from ClassA c
  inner join c.myClassBs b
  inner join b.classBsCcollection


Top
 Profile  
 
 Post subject: Thanks
PostPosted: Sun Nov 30, 2003 4:57 am 
Beginner
Beginner

Joined: Wed Sep 17, 2003 10:25 am
Posts: 36
Gavin,

Thanks for you quick reply. This worked nicely. I was too focused on doing it in one way which did not seem to work. Thanks again...


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.