If you map id as relationship key, you should consilder using simple
equalition rather than IN, e.g.:
ExpressionFactory.matchExp("toMyothertable.something", true)

otherwise, I think you can do this using EJBQLQuery [1]:
select mt FROM mytable mt WHERE mt.id in (select mot.id FROM myothertable
WHERE mot.something).

Id should be mapped from that [2].

[1] http://cayenne.apache.org/doc/ejbqlquery.html
[2] http://cwiki.apache.org/CAY/mapping-primary-keys.html

Regards,
Andrey

2009/3/4 Νίκος Παράσχου <nipar...@gmail.com>

> Hello,
>
> Could you please guide me how to code a query like the following in
> cayenne:
>
> SELECT *
> FROM mytable
> WHERE id IN (SELECT ids FROM myothertable WHERE something);
>
> One option is SQLTemplate. How could I do it with
> ExpressionFactory.inExp(...)?
>
> Thank you,
> Nikos
>
>

Reply via email to