Reputation: 71
I am developing an application using SAP Hana studio and I am confused on why I would use XSODATA and why I would use XSJS. Why can't I just use a XSODATA file to perform all of my database transactions? I get XSJS is server-side, but if I am doing basic CRUD operations could I just use XSODATA?
A related question, would the XSODATA file be create in SAP Hana studio and work fine from there? The reason I ask is because before I had to create a service in Gateway service builder and provide the URL to the application to access it. But now I am assuming everything is done on hana studio and there's no need to do anything beside this.
Upvotes: 2
Views: 6152
Reputation: 5216
You are right. If all you need is CRUDQ on the database, then XSODATA is the way to go. XSJS should be used for non-CRUD operations (e.g. custom processing operations, file uploads, etc).
And yes, you can create it directly in the HANA studio or in the Web Based Workbench. The Gateway is used when you have a Netweaver system (not necessarily a HANA system) and you want to expose some business entities from there. They are two distinct technologies (Netweaver vs HANA XS Classic) with different usage scenarios (albeit you can combine them in some cases).
Upvotes: 4
Reputation: 3994
For CRUD operations XSOData would be ideal when you are on HANA. Since XSOData implements the OData protocol, most of the heavy lifting is done by the underlying XS Engine. So once you provide the service definition you can expect everything to work out of the box. You also get the feature set of OData v2.0.
However with XSJS, you will have to implement all CRUD operations. This can be useful for complicated scenarios like when you are trying to send/recieve data from external services, identifying session users, running some dynamic sql, file upload, emails and the like. If XSOData does not fulfill you needs in such cases, XSJS is the way to go.
Also, if you are developing UI5 applications, XSOData is a better choice as it will be much easier to use OData services in UI5 compared to other REST services like XSJS.
Upvotes: 5