sap.ui.model.odata.v2.ODataModel
Congrats for the great new OData Model!
I just have played around on our HANA with OData Services from CoreDataServices. The new badgeMode works by default. Maybe also the TwoWay Binding would be a good default.
The problem is that the Updates are always using the full payload (not only changed attributes). The update is done using MERGE, but the complete DataSet is transfered to server.
Inside the model the hasPendingChanges works well, also the changed Props are correctly found.
From my point of view, update should only transfer properties that have been changed, or am i wrong?
I have created a collection Users thats maps 1:1 to expand property UserAccount which depends on Accounts. The view is binded to /Users with an $expand=UserAccount.
The UserAccount will not be directly bindable as documented, but binding a sub view fragment to /UserAccount(ID) will do the job for me.
Now i can use oModel.submitChanges() and User and also UserAccount properties will be updated, but always the whole DataSet is transported.
I also got to know, that the User aggregation force an read call on the server after update while the UmeAccount update (on the expanded node) will not fetch an read after update?!? This is currently maybe also an issue.
Do you have any addtional docu on the new mBatchGroup{} and the relation of badgeGroup and changeSet?
I also miss a feature to rollback the changes for specific entities. I think the resetChanges(aKeys) globally rejects all changes, but i think a feature like a rollback on badgeGroups or something like that would be useful.
In my case i have something like var mGroup = { "DataDictionary": { batchGroupId: "SYS", changeSetId: "?", single: true }, { "Users": { batchGroupId: "UME", changeSetId: "?", single: true }, { "Accounts": { batchGroupId: "UME", changeSetId: "?", single: true } }
In this case i would only like to the corresponding binding for User and Account
resetChanges("UME")
But the first step is a huge step into the upcomming posibilities.
Cheers Holger
Hi Holger,
thanks for your message and improvement suggestions! I've informed the colleagues working on the v2 model and they will look into these. Presently, the updates indeed always send the complete entry, so this works as designed - at least for this version - so I can confirm it's not just a bug you are facing. As for more extensive documentation, this is currently in the making. We'll keep you posted about it.
Kind regards, Christiane
Hello experts, i'm using odata model v2, i've got a question, I have 1 to M relationship between 2 entities, I populate this data using $expand option in SAPUI5, the M entity name is ApprCategorySet, but the navegation property name is ToApprCategory (inline items), i bind my table to ToApprCategory navegation property, when i delete a row the program tries to call APPRCATEGORYSET_DELETE_ENTITY what is normal, but after that tries to call APPRCATEGORYSET_GET_ENTITYSET, but I need to refresh from the principal entity to the M entity, how do I achieve this.
Thanks in advanced.
HI Jjteran, the dataset are internally stored as an flatened array concerning their keys, so they do not represent directly the 1..M assoc. What is your problem with deleting? i thinki this would be only problemativ on update if you do not have a category services. Currently deep insert/updates are also not supported ans should be done manually on the entity itself.
If the v2 OData does not fullfill your needs, maybe you need to attach events requestCompleted or batchrequestCompleted and manually trigger your reload on principal entity (maybe by replacing binding).
I am currently using 1::1 binding and also have to manually take care on saving root and depended entities independently.
Cheers Holger
Hello hschaefer123.
Thanks for your quick reply, finally i had to implement GET_ENTITYSET method to get data after deletion, now I am using batch request to send APPRCATEGORY entity data to the backend using v2 Odata and CHANGESET methods, this works well, but the records deleted doesn't disappear inmediatetly from my sap.m.table, and just dissappear when method submitChanges() is called. I tried deleting programatically from deleting button event, but no success with this. This same logic was working when the changes are inmediately posted to the backend (when not in change set batch). Please may be you know how to make batch changes that could be reflected inmediately in my view, because i can't wait to refresh the view when the save button is pressed.


Again i appreciate the help you could give me.
Are you on 1.28.2?
If not, play around with the oData params.
oDataServiceConfig : { serviceUrl : "/uniorg/bonvendo/uis/MODUL/SUBMODUL/{launchPadId}.xsodata", defaultCountMode : "None", // None|Inline, None for fulltext search sizeLimit : 500, useBatch : false, //deferredBatchGroups : ["changes"], // since 1.28.2.default // changeBatchGroups default : {"" : {batchGroupId : "changes", single : true}} / changeBatchGroups : { "*" : { batchGroupId : "changes", changeSetId: "ID", single : true } },
Before 1.28.2 i had to overwrite the deferredBatchGroups to get such a behavior!
some params are in constructor
var oODataModel = new sap.ui.model.odata.v2.ODataModel(sServiceUrl, {
useBatch : mConfig.oDataServiceConfig.useBatch,
refreshAfterChange : mConfig.oDataServiceConfig.refreshAfterChange
});
some are/are not
oDataModel.setDefaultBindingMode("TwoWay"); oDataModel.setSizeLimit(mConfig.oDataServiceConfig.sizeLimit); oDataModel.setDefaultCountMode(mConfig.oDataServiceConfig.defaultCountMode); oDataModel.setChangeBatchGroups(mConfig.oDataServiceConfig.changeBatchGroups); oDataModel.setDeferredBatchGroups(mConfig.oDataServiceConfig.deferredBatchGroups);
This way i was able to control insert/updates/deletions (with auto updating the binding) if using TwoWayBinding (not the default)
Maybe this helps
Thanks Holger. I'm using sapui5 version 1.26.10 and using two way binding, when you say overwrite is that even if I set this parameters in constructor, I have to set using the setter methods as well? besides I can't see if you are using refreshAfterChange = false (I suppose). I also see that you set the useBatch = false, with this value it doesn't work submitChanges() method.

Regards.
Jhon Jairo Teran
Hello Holger, in post https://github.com/SAP/openui5/issues/420#issuecomment-98632762 they tell me that I can't have inmediate auto updating the binding with TwoWay binding and deffered batch changes, always I have to wait until submitChanges() method to refresh. Finally could you do some workaround to achieve this?
I apologize for the inconveniences but, I'm really stuck with this,I don't know if using a combination of json model and odata model I could get this to work.
Kind regards.
Jhon Jairo Teran.
Hello. So what is the right way to perform this action?
Hi @hschaefer123 , @jjteran ,
this issue has been open for some years. I have noted the following topics:
- MERGE only sends delta payload: This had been realized.
- Documentation: There have been improvements in the documentation in the past seven years. If there are current issues, I propose to either reopen the issue or, better, to open a new one.
- More flexible sap.ui.model.odata.v2.ODataModel#resetChanges: It is possible to specify specific paths for which changes should be reset.
- Deferred Delete directly reflected in the table: This has not been realized and is not on the agenda for OData V2. For OData V4 we have a corresponding roadmap item, but it is at this point too early to get into the details of the concrete behavior.
I close the issue as the main points seem to have been addressed.
Best regards Mathias.