-->
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: why this query doesn't work ?
PostPosted: Fri Oct 30, 2009 11:51 am 
Newbie

Joined: Mon Jul 09, 2007 9:32 am
Posts: 17
Say I have a code below, I want to search project based on employee hired date

Code:
select p.id from Project p where p.empList.hireDate > '01/01/1970' and p.empList.hireDate < '01/01/1990'

Why this query doesn't work ? how to fix it ?

Thanks.

Code:
class Project {
    Long id;
     List<Employee> empList;
}
class Employee{
    String name;
    Date hireDate;
}


Top
 Profile  
 
 Post subject: Re: why this query doesn't work ?
PostPosted: Fri Oct 30, 2009 11:53 am 
Newbie

Joined: Fri Oct 30, 2009 11:41 am
Posts: 6
p.empList seems to be a list of employees, not a employee


Top
 Profile  
 
 Post subject: Re: why this query doesn't work ?
PostPosted: Fri Oct 30, 2009 12:08 pm 
Newbie

Joined: Fri Oct 30, 2009 11:41 am
Posts: 6
maybe something like
Code:
select p.id from Project p inner join fetch p.empList as emp where emp.hireDate > '01/01/1970' and p.empList.hireDate < '01/01/1990'


Top
 Profile  
 
 Post subject: Re: why this query doesn't work ?
PostPosted: Fri Oct 30, 2009 1:04 pm 
Newbie

Joined: Wed Mar 08, 2006 5:48 pm
Posts: 4
In what way doesn't it work?


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.