Entity refers to itself using reference set: difference between retrieve using association and from DB

I have an entity that refers to itself using a reference set: any given object can depend on a number of objects. In the details page this works fine, retrieve by association works fine too. However, when I retrieve from database, the reference set suddenly works the other way. I narrowed this down to a test situation that allows easy reproduction. Main Item 1 depends on Sub item a and b Main Item 2 depends on Sub item b and c The detail page and the retrieve by association show this correctly. The retrieve by database shows no dependencies for the two main items, but shows Sub item b depends on the two main items. Does anyone know how to retrieve such a reference from the database correctly? Edit: The real project (the multi-tenant backup) uses Java. I just noticed some rather dark stuff going on in the generated entity proxy classes. Is this way of working with IMendixObject for Mendix internal only or also allowed/supported? The export is on Git along with screenshots: https://github.com/mgroeneweg/CrashTestDummies
1 answers

Use reversed().