OData support fails when referenced data is deleted
Hi, I found out that the OData services fail when you delete referenced data. In my example I have the Car entity exposed, and the system members like Store 'owner' enabled in the domain model. In this test scenario there were some cars in the database which owners have been removed from the system. Now if you use the OData service to get the cars in Excel or any other program, you get the following error in the mendix log file: The association 'System.owner' of object 'Test.Car' with data store id '24206847997116617' refers to a non-existing object 'System.User' with data store id '40813871623050321'. Then the OData feed in your Excel program will generate an error saying: Unexpected XML declaration. The XML declaration must be the first node in the document, and no white space characters are allowed to appear before it. Should I file a ticket for support or?
Confirmed the issue in 6.10.5, but just with the 'owner' of objects..
It appears that the System.owner is not emptied when deleting the account that created the object.
I'm not sure if that is a bug or intended behaviour. Mendix treats this somewhat differently: it is not stored in an association table, for example.
In any case, it's probably better not to expose that association, but instead define your own association between user (or account) and your entity (car).
Those associations are emptied correctly and do not give any problems in the OData service.
Nevertheless, you can file a ticket to see if this is the intended behavior for 'owner' references.
Hope this helps!