db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frederic Gedin <frederic.ge...@Jaluna.COM>
Subject Re: Criteria quizz
Date Fri, 14 Mar 2003 16:04:50 GMT
Dan

Doing it this way is a really good idea.  Many thanks

Frederic


Dan Allen wrote:

>>Now I would like to find all the tasks with no assigned worker.
>>
>>How to do it?
>>    
>>
>
>Make your life easy and do it in two queries.
>
> Criteria crit = new Criteria();
> crit.addGroupByColumn(AssignmentPeer.TASK_ID);
> List filledTasks = AssignmentPeer.doSelect(crit);
>
> List filledTaskIds = new ArrayList();
> Iterator iter = filledTasks.iterator();
> while (iter.hasNext())
> {
>     filledTaskIds.add(new Integer(((Task)iter.next()).getTaskId()));
> }
> 
> crit.clear();
> crit.add(TaskPeer.TASK_ID, filledTaskIds, Criteria.NOT_IN);
> List unfilledTasks = TaskPeer.doSelect(crit);
>
>voila!
>
>Dan
>
>  
>



Mime
View raw message