The issue is happening because the returned result structure from OQL does not match the structure of your Non-Persistable Entity.
With View Entities, Mendix internally handles the result set, and if the query does not define the result shape properly, additional metadata/identifier columns can appear during mapping.
Instead of trying to map the generated ID, I normally keep the OQL result exactly aligned with the expected output.
A common approach is:
SELECT
AuditName AS Name
FROM AppMain.AuditUserView
GROUP BY AuditName
The idea is:
Example:
Non-Persistable Entity:
AuditResult └── Name (String)
OQL:
SELECT
AuditName AS Name
FROM AppMain.AuditUserView
GROUP BY AuditName
Now the runtime mapping becomes: AuditName → Name without expecting the generated ID column.
This approach keeps the OQL result clean and avoids the mapping error.
Kindly mark this as the accepted answer if it helps.
Dear Krishnakumar
i used your approach, but it does not work, the error still exists.
Caused by: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: java.lang.RuntimeException: Could not find result association ID in target object.
My OQL in microflow:
select C.asn as asn
from BinGR.CDH_Bin_GR_AggASN_View C
group by asn
from BinGR.CDH_Bin_GR_AggASN_View is a OQL Entity