Stop using sap.ui.model.odata.ODataModel aka V1 ODataModel – it’s deprecated since 2015!
A few days ago I wrote a blog about deprecated SAP GW APIs here in the SAP Gateway Community. If you use the ODataModel in UI5 you have multiple options:
Feel free to choose which one you want to use – NOT!
Don’t use sap.ui.model.odata.ODataModel because it’s deprecated! Yes, that’s correct! That’s why it’s not used in in any of the tutorials! And this information is not new. In fact, it’s deprecated since summer 2015 if I remember right. However, this is not clearly mentioned in the API docs:
From the API docs (see screenshot and/or links above) you would not guess it’s deprecated. However, have a look at SAPUI5 1.30.6 – Instantiating an OData Model and SAPUI5 1.42.8 – OData V2 Model of the Developer Guide:
“The v2.ODataModel has an improved feature set and new features will only be implemented in this model. sap.ui.model.odata.ODataModel is deprecated. We recommend to only use v2.ODataModel.”
Especially for new apps make sure you use the v2.ODataModel or (if you can) the v4.ODataModel. When I make code reviews I typically reject code/apps using the old ODataModel. In the view of some developers this might look a little harsh… Hmm, what do you think?
UPDATE: The correct year is 2015 and not 2014
Thanks for pointing this out, indeed one should avoid using deprecated APIs, especially in the model as it does not contain various improvements we did in OData model V2.
In the near future, we will also have an application check that can be executed on app level and make this more visible.
Hi Michael. I guess you were talking about the support assistant which has become an awesome tool btw. But I'm afraid it's not really discoverable by beginners who don't know about this feature. They then keep using the old ODataModel without knowing how bad it is. I recently had to point someone to this blog post again to make it clear that ODataModel he/she is using is deprecated.
Are there any plans to make the deprecation message much more visible? E.g. logging a big fat error message in the console (in addition to the support assistant) regardless of the loglevel.