[JIRA] Created: (CAY-804) Incorrect syntax generated for 'noMatch' exparessions when matched against objects with compound PK

From: Andrus Adamchik (JIRA) ("Andrus)
Date: Wed Jun 13 2007 - 07:52:28 EDT

  • Next message: Andrus Adamchik (JIRA): "[JIRA] Created: (CAY-805) SQLTemplate improvement: new #bindColumnsEqual #bindColumnsNotEqual directives"

    Incorrect syntax generated for 'noMatch' exparessions when matched against objects with compound PK
    ---------------------------------------------------------------------------------------------------

                     Key: CAY-804
                     URL: https://issues.apache.org/cayenne/browse/CAY-804
                 Project: Cayenne
              Issue Type: Bug
        Affects Versions: 1.2 [STABLE], 2.0 [STABLE], 3.0
                Reporter: Andrus Adamchik
                Assignee: Andrus Adamchik
                Priority: Minor
                 Fix For: 3.0

    Consider this unit test:

           CompoundPkTestEntity t = (CompoundPkTestEntity) context.newObject(CompoundPkTestEntity.class);
            t.setKey1("X");
            t.setKey2("Y");
            context.commitChanges();
            
            Expression e = ExpressionFactory.noMatchExp("toCompoundPk", t);
            context.performQuery(new SelectQuery(CompoundFkTestEntity.class, e));

    The actual SQL generated is this:

           SELECT t0.F_KEY1, t0.F_KEY2, t0.NAME, t0.PKEY FROM COMPOUND_FK_TEST t0 WHERE t0.F_KEY2 <> ? AND t0.F_KEY1 <> ? [bind: 'Y', 'X']

    While it should be this (OR instead of AND)

           SELECT t0.F_KEY1, t0.F_KEY2, t0.NAME, t0.PKEY FROM COMPOUND_FK_TEST t0 WHERE t0.F_KEY2 <> ? OR t0.F_KEY1 <> ? [bind: 'Y', 'X']

    -- 
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.
    



    This archive was generated by hypermail 2.0.0 : Wed Jun 13 2007 - 07:53:03 EDT