Hello Andreas,
I would check that you’re not attempting to create two objects at the same time. It would be useful to see some of your flows.
I would also suggest checking your DB at the time of the commit – you can do this by sticking a break point and directly looking into the DB on a local machine, or you can try to do a retrieve from DB for a match in case you’re running this on a server.
On a side note, I suggest not adding CaseNr as an attribute on CT_Item, if you need to show the CaseNr you can always do it via association, there is no need to duplicate attributes from CT_Overview to CT_Item.
Hope this helps
CaseNr on the CT_Overview entity must be unique, this is checked by Mendix on database level.
CaseNr on the CT_Item has no unique constraint enabled
Follow-up:
After trying the suggestions from the replies to this thread, I have settled with the approach of performing validations in the microflow that saves the object - this is partly because using a Before Commit event did not stop the object from being committed if the BCO microflow returned false, and partly because all changes made to the CT_Overview entity already has a microflow for validating that all fields are filled out properly.