We have a database where all entities have a qualifier for "deleted" field,
which is added via DbEntity.setQualifier(Expression) during DataMap loading.
When we create a SelectQuery, this qualifiers added in join "ON" node with
wrong table alias.
So our query looks like this:
SELECT DISTINCT t0.CUSTOMERID AS c0,
      UPPER(t0.CUSTOMERLASTNAME)   AS c1
    FROM CUSTOMER t0
    LEFT JOIN CUSTOMER_GROUP t1
    ON (t0.CUSTOMERID = t1.CUSTOMERID
    AND t0.DELETED    = 0)
    JOIN GROUP t2
    ON (t1.GROUPID = t2.GROUPID
    AND t0.DELETED = 0)
    WHERE (t2.GROUPTYPEID = 101100100145)
    AND (t0.DELETED       = 0)
    ORDER BY UPPER(t0.CUSTOMERLASTNAME)
   ;
Earlier we've used cayenne-3.0RC3, and there queries with same DataMap and
qualifiers creates correctly
SELECT DISTINCT t0.CUSTOMERID,
      UPPER(t0.CUSTOMERLASTNAME)
    FROM CUSTOMER t0
    LEFT JOIN CUSTOMER_GROUP t1
    ON (t0.CUSTOMERID = t1.CUSTOMERID
    AND t1.DELETED    = 0)
    JOIN GROUP t2
    ON (t1.GROUPID = t2.GROUPID
    AND t2.DELETED = 0)
    WHERE (t2.GROUPTYPEID = 101100100145)
    AND (t0.DELETED       = 0)
    ORDER BY UPPER(t0.CUSTOMERLASTNAME)
;

--
Vladimir Suhinin

Reply via email to