Check if object is already added to reference set withoud DB interaction
0
Hi. I'm iterating a list of "Entity1" in a Microflow and for each $Entity1Iterator I need to know whether it's already added to the Reference Set $Entity2/MyFirstModule.Entity2_Entity1. The objects are persistable and they have no dirty members. The most obvious solution is to copy the reference set into a list and then use "Contains". However, copying leads to DB interaction because Mendix has to fetch an object for each GUID in the Reference Set to add it to the list. I tried the opposite: create a "holder" list, add $Entity1Iterator to it and then remove $Entity2/MyFirstModule.Entity2_Entity1 from it. I hoped that Mendix had an optimization for "remove" because you don't need an object for that, only the GUID. But it still leads to DB interaction. Finally, I tried to temporarily remove $Entity1Iterator from $Entity2/MyFirstModule.Entity2_Entity1 using a "Change object" activity and rollback the object immediately. However, the only check that's available is comparison to empty. If the reference set contains other GUIDs I can't tell $Entity1Iterator was successfully removed. Is java the only option?