-->
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: A tip
PostPosted: Wed Jun 09, 2004 8:18 am 
Senior
Senior

Joined: Wed Sep 24, 2003 3:01 pm
Posts: 158
Location: Bragan�a Paulista - Brasil
Hi,

-------------------------
I have a Company:

String companyId;

List employees;

-------------------------
And I have the Employee:

String employeeId;

String name;

String employeeStatus;


I need to build a query that find the companies with only the employees
with employeeStatus = 1;

So, I made this:

from Company c left join c.employees e
where e.employee.employeeStatus = '1';

But it return the company list with all employees (list).

Other solution is:

select c.name, ...., e.employeeStatus
from Company c left join c.employees e
where e.employee.employeeStatus = '1';

Is this the only way for this???

thanks

_________________
Tads


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 09, 2004 10:17 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
select c from Company c left join ...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 09, 2004 10:40 am 
Senior
Senior

Joined: Wed Sep 24, 2003 3:01 pm
Posts: 158
Location: Bragan�a Paulista - Brasil
Hi,
thanks for your attention....

But in this way, it is returned list of company with all list of employees.

_________________
Tads


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 09, 2004 2:29 pm 
Senior
Senior

Joined: Wed Sep 24, 2003 3:01 pm
Posts: 158
Location: Bragan�a Paulista - Brasil
Hibernate allows to return Objects (that contains an attribute of type List)with only some elements of these collection?

I would like to know how to find this, because I don

_________________
Tads


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.