cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrey Razumovsky <razumovsky.and...@gmail.com>
Subject Re: How to use inExp(...)
Date Wed, 04 Mar 2009 10:45:54 GMT
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 Νίκος Παράσχου <niparasc@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
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message