cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 & OData: Multiple service calls vs single service call with multiple entities

declan_barrett1
Explorer
0 Kudos
201

Hi,

We have a requirement to create a SAPUI5 application that will display data from multiple mainly non-related tables using OData V2. We'll be using VSCode to create the UI5 application.

Is it better to:

a) create a separate OData service for each table and have multiple datasources in the manifest.json

or

b) one OData service containing multiple entities (each entity would relate to an individual DB table) ?

If the answer is b) then how do we structure the OData service and related manifest.json to retrieve all the required data from the one OData service?

All help greatly appreciated.

 

 

 

View Entire Topic
junwu
SAP Champion
SAP Champion
0 Kudos

I would go b.

 

If the answer is b) then how do we structure the OData service and related manifest.json to retrieve all the required data from the one OData service?

don't know what you are talking

 

declan_barrett1
Explorer
0 Kudos
If we create only one OData service with multiple entity sets, will all the required data be retrieved when the OData service is called or is there a need to create associations & navigations between the non-related entity sets?
akuller
Participant
0 Kudos
I also go with b, if only because of batch. But I also don't understand what exactly you want to ask. It all depends on your data model and your app ... the best thing would probably be to have a look at the documentation to understand how it all works together.
declan_barrett1
Explorer
0 Kudos

ok - for example if I have an odata service xyz.srv and it contains 2 entity sets bankmasterSet and vendormasterSet with their GetEntity and GetEntitySet queries etc fully generated but they have no associations.

In the UI5 application, the manifest.json file references the odata service xyz.srv in the datasource section and the models section. When the service is called by the UI5 application, is the data for both entity sets automatically retrieved from the backend or is it just one entity set that is retrieved?

Another way of asking is, if I have data on 2 or more database tables, in the SAP backend, that have no relationship to each other, can I use just one OData service to expose the data to a UI5 application or do I need to create an OData service for each DB table?

akuller
Participant

> When the service is called by the UI5 application, is the data for both entity sets automatically retrieved from the backend or is it just one entity set that is retrieved?

depends on the implementation of the app, possibly yes. here too, take a look at the documentation, keyword batch.

can I use just one OData service to expose the data to a UI5 application or do I need to create an OData service for each DB table?

if you ask me, there should be one service responsible for an app. it contains everything. some people think differently, i would like to keep the complexity and responsibilities to a minimum. but here too there is documentation and a service for every table is absolute nonsense.

 

junwu
SAP Champion
SAP Champion
0 Kudos
only the entity you are targetting will be returned.