Re: Prefetch SQL drops part of join

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon Aug 22 2005 - 16:34:52 EDT

  • Next message: Andrus Adamchik: "Re: Weird behavior (M5)"

    Neil,

    this is a bug. I was able to reproduce it - http://objectstyle.org/
    jira/secure/ViewIssue.jspa?key=CAY-352

    I started with a complex example similar to yours and then simplified
    it to a very simple qualifier:

    Expression exp = Expression.fromString("estimatedPrice = null");
    SelectQuery q = new SelectQuery(Painting.class, exp);
    q.addPrefetch("toArtist");

    ... and the problem still appeared. So null comparison is not
    translated correctly. It is logged in JIRA and will be fixed.

    Andrus

    On Aug 22, 2005, at 8:25 PM, Neil Pierson wrote:

    > I'm having trouble with prefetches in Cayenne 1.1. I have a table
    > -- "MasterTable" in the log snippet below -- that has a to-one
    > relationship to another table that I join to using an expression.
    > The 'Status' column is a varchar2 in my Oracle 9 db. I need the
    > status to be null, or not equal to a certain value. The SQL that
    > gets generated looks fine for the query itself: . . . AND
    > ((t0.Status IS NULL) OR (t0.Status <> ?))) . . . but when
    > prefetching other relationships to the MasterTable causes part of
    > the join to be dropped. Specifically, the (t0.Status <> ?) part of
    > the join is used, but not the (t0.Status IS NULL) part. The
    > behavior is the same for prefetching any other relationship, and
    > it's the same if the relationship is to-one or to-many. The
    > behavior is also the same if I create the query in the model and
    > use query.andQualifier(some expression) or create the query right
    > in my class.
    >
    > Any ideas of what I might be doing wrong or a possible workaround
    > if it's not me?
    >
    > TIA,
    >



    This archive was generated by hypermail 2.0.0 : Mon Aug 22 2005 - 16:34:57 EDT