OpenUI5 version: 1.84
class sap.ui.model.odata.v2.ODataModel
Browser/version (+device/version):
Chrome/87.0.4280.66 (Windows 10)
URL (minimal example if possible):
https://plnkr.co/edit/MKsWavwsN76kaO3r
Steps to reproduce the problem:
What is the expected result?
The frontend sends two entries as a change-set. The Gateway executes them in the order they were added:
1
2
As one of them fails, the entire change-set gets the status โ400 Bad requestโ. Two entries contained in the changes-set remain marked as Pending.
After adding the third entry I expect that submitChanges will send a request in this order:
1
2
3
What happens instead?
Change-set is sent as:
3
1
2
Hi @gmalew ,
We have created an internal incident to follow-up with this issue.
(Incident no. 2080415848)
Thank you.
Best regards,
Jay
Hi @gmalew ,
why do you think it is important to ensure the order? There are requests for different independent entities. If you would modify a create entity the content would be merged.
Best Regards,
Sven
Hi @SvBE, The test case does not show it but the customer scenario does have another entity. We need to create the main document together with its dependant documents, attached to the main one.
In general, the order in the change-set is important as the change-set is the only way to ensure that a task that has a number of steps can be reprocessed if one of them fails. The steps are bound together as they are dependent on each other.
Hi @gmalew,
I see, if I create two sales order items for example I would expect that they are added in the correct order in the sales order.
The Pull request 3097 seems not to solve the issue as there is at least one failing test: sap/ui/core/qunit/odata/v2/V2ODataModel.qunit.js.
I am checking the issue and I am looking for a solution.
Hi @SvBe, is the author action label correct? Is there anything that @urgens or I can do to help move this issue forward? Do you have any suggestions for an alternative place in code to make the adjustments?
[Minor] Fixed the labels according to my understanding. @SvBe feel free to adapt them again if you think they don't fit.
Sorry, missed to remove the author action label.
I am still trying to provide a fix for this issue without breaking existing scenarios.
But even if we implement that, it is not ensured that the backend processes the requests as wanted. See https://www.odata.org/documentation/odata-version-2-0/batch-processing/ section 2.2. Batch Request Body:
"A ChangeSet is an atomic unit of work that is made up of an unordered group of one or more of the insert, update or delete operations"
Hi @gmalew,
I tried different things to keep the ordering of the request, but I couldn't find a solution yet that does not break existing test.
We do not consider this issue as a bug as the OData V2 specification explicitly mentions "A ChangeSet is an atomic unit of work that is made up of an unordered group of one or more of the insert, update or delete operations". So it depends on the backend whether to process the requests step by step or maybe in parallel.
If you really need this, you can post a feature request. So I close this incident.
Some general remarks. The OData V2 model does not support deep creates, that means creating an entity and in the same $batch create dependent entities, see https://sapui5.hana.ondemand.com/#/api/sap.ui.model.odata.v2.ODataModel%23methods/createEntry (Please note that deep creates (including data defined by navigation properties) are not supported.)
If you need to create dependent entities you have to wait until the outer entity creation is successfully finished before triggering the creation of dependent entries.
Most helpful comment
Hi @gmalew,
I see, if I create two sales order items for example I would expect that they are added in the correct order in the sales order.
The Pull request 3097 seems not to solve the issue as there is at least one failing test: sap/ui/core/qunit/odata/v2/V2ODataModel.qunit.js.
I am checking the issue and I am looking for a solution.