Reputation: 8297
when the Update is being done by different users on the same entity at the same time, how to detect if that entity has been updated just before saving and prevent the second update from happening and push the new data to the second user.
Can e-tag be used?
Upvotes: 0
Views: 1057
Reputation: 61
SAP Gateway doesn't support pessimistic locking (i.e. expecting someone else to edit the same document while someone else is already editing it) instead supports optimistic locking(i.e. does not expects someone else to edit at the same time) due to stateless nature of RESTful web services. So here are the options:
Upvotes: 0
Reputation: 345
Yes, that is exactly what etags are for. In case it is SAP Gateway as a backend, there is already support there and in the ODataModel in SAPUI5, so just need to send the etag to the client and validate it (on the server) when an update is made. If it has been changed in the mean time, an error will be sent to the client informing him that the entity has been changed since he loaded it (HTTP status 412).
Upvotes: 0