Skip to Content
avatar image
Former Member

what benefits do I get from using oData model vs Json model

I'm reading data from HANA using a JSON model and simply passing in the URL to the source and retrieving it as in the following:

var data = new sap.ui.model.json.JSONModel(urlPath);

Then I can bind it to my view.

I have also seen the following way of doing it, where an oData model is created and then the JSON model is created from the oData.

var oModel = new sap.ui.model.odata.ODataModel(urlPath);       
oModelJson = new sap.ui.model.json.JSONModel();
oModel.read("/Items", null, ["$filter=ImItems eq 'imputParameter'"], null, function(oData, oResponse){ 
   oModelJson.setData(oData);
}, null );
 

What difference is there in creating the oData model first than creating the json model at once. So assuming I'm getting back from the database about 5,000 data points, which approach should I use, or is there be no difference?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Dec 21, 2016 at 04:22 AM

    it will be more easier to use odata model to communicate with odata service.

    odata query can be very complex, you are using simple one, that's why you didn't see the difference.

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 22, 2016 at 08:25 PM

    the main difference between the 2 model types is that :

    oData models are server side -

    JSON models are client side -

    you can manipulate the json model easier from the client side .. whereas the odata model would have to be interacted with and updated from the server side which involves network interaction. you could do the interaction with the client side model and not having to submit anything until you are ready for it

    Add comment
    10|10000 characters needed characters exceeded