-->
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.  [ 2 posts ] 
Author Message
 Post subject: Fetching parts of a collection
PostPosted: Mon Mar 22, 2010 3:56 am 
Newbie

Joined: Mon Oct 10, 2005 6:11 am
Posts: 10
Hi

I have a Classrom object which holds collection of Student objects.

I want to build a query that gives me all the classrooms with specific students.
I tried this:

from Classroom c left outer join c.students as student where student.birthYear > 1981;

This is not good, because it returns a Classrom, and all of the Students, if one student's birth date is greater than 1981.
What i want is to return the Classroom, and the filtered collection of Students.

Any idea?


Top
 Profile  
 
 Post subject: Re: Fetching parts of a collection
PostPosted: Mon Mar 22, 2010 4:11 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
I would try to use a inner join instead to a 'left outer' join.


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