Hi Christoph,
the following xquery results in duplicate keys or missed updates, if we get two messages of the same person in one xml-document. All updates in the database are done at the end of the xquery and the reading inbetween gets the old state of the database.
Correct. This is dictated by the XQuery Update Facility and helps to bypass problems with dirty reads etc.
Is there a command to persist the actual state (like commit in sql)? If not, i need some help for my design, because i have no idea, how to get a stable processing.
No. There is no way to interfere with this mechanism. As a rule of thumb - to modify the same item or node within the same transaction several times calls for an aggregation of all changes beforehand and applying these as a single update. In your specific case, 'updateMitglied()’ should be called only once with parameters that lead to a consistent state of a ‘Mitglied’. With the information you gave us I assume this starts with a ‘group by person’ on the messages …
Hope this helps, cheers, Lukas