refer oject on the path inside Sub-constraints

0
Hi. I have two associated entities.       I need to retrieve a list of Entity_1 whose referenced Entity_2 match by a combination of multiple attributes: E2Attribute1 = E1Attribute1 and E2Attribute2 = E1Attribute2   I tried to use Sub-constraints, but I can't figure how to refer the current Entity_1 from inside the sub-constraint. [MyFirstModule.Entity_1_Entity_2/MyFirstModule.Entity_2 [E2Attribute1 = E1Attribute1] [E2Attribute2 = E1Attribute2] ] "Could not find attribute 'E1Attribute1' in entity 'MyFirstModule.Entity_2"   And the following produces wrong SQL (Entity_2 is joined twice): [MyFirstModule.Entity_1_Entity_2/MyFirstModule.Entity_2/E2Attribute1 = E1Attribute1] [MyFirstModule.Entity_1_Entity_2/MyFirstModule.Entity_2/E2Attribute2 = E1Attribute2] _ SELECT "myfirstmodule$entity_1"."id", "myfirstmodule$entity_1"."e1attribute1", "myfirstmodule$entity_1"."e1attribute2" FROM "myfirstmodule$entity_1" WHERE "myfirstmodule$entity_1"."id" IN (SELECT "x1MyFirstModule$Entity_1"."id" FROM "myfirstmodule$entity_1" "x1MyFirstModule$Entity_1" INNER JOIN "myfirstmodule$entity_1_entity_2" "atj1MyFirstModule$Entity_1_Entity_2" ON "atj1MyFirstModule$Entity_1_Entity_2"."myfirstmodule$entity_1id" = "x1MyFirstModule$Entity_1"."id" INNER JOIN "myfirstmodule$entity_2" "MyFirstModule.Entity_2" ON "MyFirstModule.Entity_2"."id" = "atj1MyFirstModule$Entity_1_Entity_2"."myfirstmodule$entity_2id" INNER JOIN "myfirstmodule$entity_1_entity_2" "atj2MyFirstModule$Entity_1_Entity_2" ON "atj2MyFirstModule$Entity_1_Entity_2"."myfirstmodule$entity_1id" = "x1MyFirstModule$Entity_1"."id" INNER JOIN "myfirstmodule$entity_2" "x2MyFirstModule$Entity_2" ON "x2MyFirstModule$Entity_2"."id" = "atj2MyFirstModule$Entity_1_Entity_2"."myfirstmodule$entity_2id" WHERE "MyFirstModule.Entity_2"."e2attribute1" = "x1MyFirstModule$Entity_1"."e1attribute1" AND "x2MyFirstModule$Entity_2"."e2attribute2" = "x1MyFirstModule$Entity_1"."e1attribute2" )  
asked
0 answers