Re: How to use inExp(...)

From: Andrey Razumovsky (razumovsky.andre..mail.com)
Date: Wed Mar 04 2009 - 05:45:54 EST

  • Next message: Paul Logasa Bogen II: "Problem commiting changes back to database"

    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 <niparas..mail.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
    >
    >



    This archive was generated by hypermail 2.0.0 : Wed Mar 04 2009 - 05:46:37 EST