Andrus Adamchik created CAY-3006:
------------------------------------

             Summary: Can't match a "self" property of an entity with a 
compound PK
                 Key: CAY-3006
                 URL: https://issues.apache.org/jira/browse/CAY-3006
             Project: Cayenne
          Issue Type: Bug
            Reporter: Andrus Adamchik
            Assignee: Andrus Adamchik
             Fix For: 5.0-M4


Comparing an entity to an ObjectId or a Persistent via its "self" property 
fails when the entity has a compound PK:

{noformat}
ObjectId id = ObjectId.of("CompoundPkTestEntity", Map.of("KEY1", "PK1", "KEY2", 
"PK2"));

ObjectSelect.query(CompoundPkTestEntity.class)
              .where(CompoundPkTestEntity.SELF.eqId(id))
              .selectOne(context);
{noformat}
  throws:

{noformat}
CayenneRuntimeException: Unable to translate reference on entity with more than 
one PK.
{noformat}

 The same comparison against a *related* entity with a compound PK works fine,  
"self" behaves differently from every other entity property:

{noformat}
// works
CompoundFkTestEntity.TO_COMPOUND_PK.eqId(id)
{noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to