Re: Help with object-oriented queries

From: Cris Daniluk (cris.danilu..mail.com)
Date: Mon Sep 05 2005 - 16:36:09 EDT

  • Next message: Cris Daniluk: "Re: Synchronization after SQLTemplate"

    Seems like you ought to just use a SQLTemplate to return a list of PKs
    corresponding to "SELECT image.contentType FROM Image", then pass that
    into ExpressionFactory.notInExp().

    You could do the whole thing with a SQLTemplate, but I personally
    prefer using a standard query when possible. This uses the SQLTemplate
    for the necessary portion...

    Incidentally, will joint prefetches support exclusion sets? Queries
    like this could be handled on an outer join, filtering for results
    with no match, rather than results with a match..

    On 9/4/05, Gili <cowwo..bs.darktech.org> wrote:
    >
    > I'm trying to translate this SQL query into a object-oriented form (for
    > use with SelectQuery)...
    >
    > from contentType as type where type.id not in (select image.contentType
    > from Image as img)
    >
    > So basically, iterate over all images in the database and return the
    > list of all content-types in the DB but not used by any image (i.e. find
    > the orphan content-type rows).
    >
    > I'm not familiar with the concept of query roots or how to issue a OO
    > query which involves more than a single object.
    >
    > Gili
    > --
    > http://www.desktopbeautifier.com/
    >



    This archive was generated by hypermail 2.0.0 : Mon Sep 05 2005 - 16:36:10 EDT