Hello All, I am trying to figure out how to mention entity association in an OQL query in java code. How do i reach to the associated entity? I tried SELECT A1.attribute1 AS atr1 FROM module.entity1 as A1 WHERE A1.attribute = 'string' And A1/module.AssociationName= id of associated row in associated object Its the last line of query that is giving error in OQL window in mendix modeler and in SQL server as well. (I have modified and put correct tables in both)
You need to use an INNER JOIN clause, so something like:
SELECT A1.attribute1 AS atr1
FROM module.entity1 as A
INNER JOIN module.entity1_entity2/module.entity2 as B
A.atr1 = 'string'
The OQL INNER JOIN over association will be automatically interpreted by the SQL engine of Mendix as an A.ID on B.ID join