In short: Yes, this is expected behavior. Multiple versions of the same object can exist in memory.
ASS_ENT_3 is not yet in the current local "state" of the sub-microflow, it may pull a fresh copy from the database, which doesn't have your changes.ENT_1 before calling the sub-microflow.ENT_1 directly to the sub-microflow to ensure you are working on the same memory instance.Hello Didier,
This seems in fact to be expected behaviour,
It is possible to have "different instances" of the same object in memory, with the same ID, because you change an object and never commit it, later you retrieve it through a different association this will still point to an older in memory instance (without the changes you made to the first intance you retrieved and changed). In Mendix you can't guarantee a single in memory intance of an object.
So when you retrieve this object (ENT_1) through association A you get instance 1#
Then you retrieve same object (ENT_1) through association B you get instance 2#
Both with the same ID.
I can't fully grasp the logic here from your example, but I recommend with this information you maybe commit the changes and do a database retrieve so you are sure to use always the same instance of the ENT_1 and test this logic.
Also another important concept it may be usefull to know about the by association retrieves, when an object is retrieved by association but it is not in cache Mendix will retrieve it from the database as described in the documentation here:
When retrieving data by association, the platform will first determine whether the requested objects are already available in the memory (1-2), in the so-called object cache. If the data is not available, the platform will retrieve the object from the database (3-4). You can use the debugging tools in Studio Pro to verify whether an object is retrieved from the memory or the database."
Hope this helps, if you have any further question or want to expose some screenshots with the example please feel free.