Jeff Schnitzer wrote:

>Here's my reason for not liking Criteria (and where CrossDB falls down
>as well):  It doesn't handle joins.
>
>Given tables/objects like this:
>
>department (id, name, location)
>employee (id, name, depId)
>
>I want to be able to select all employees who are in San Francisco like
>this:
>
>SELECT e.*
>  FROM employee e, department d
>  WHERE e.depId = d.id AND d.location = 'San Francisco';
>
>Criteria doesn't try, 
>
Really?  I seem to have been able to perform joins using Criteria.

e.g.

Criteria x_crit = new Criteria();
x_crit.addJoin(DepartmentPeer.id,EmployeePeer.depId);
Criteria.Criterion x_location_criterion = 
x_crit.getNewCriterion(DepartmentPeer.location,"San Francisco", 
Criteria.EQUAL);
x_crit.add(x_location_criterion);
Vector x_v = EmployeePeer.doSelect(x_crit);

I'm not sure this will give you exactly what you want, and you may need 
to cast the "San Francisco" string as an object, but I'm regularly using 
Criterion for joins with no trouble so far.

CHEERS> SAM




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to