SAP HANA SPS 09: New Developer Features; New XSODATA Features
SAP HANA SPS 09: New Developer Features; New XSODATA
This blog is part of the larger series on all new developer features in SAP HANA SPS 09:https://scn.sap.com/community/developer-center/hana/blog/2014/12/02/sap-hana-sps-09-new-developer-features
In this blog we will look at new features in the XSODATA service framework in SAP HANA SPS 09.
Configurable Cache-settings for the $metadata request
When calling OData services, the $metadata document is often requested over and over again. Yet changes to the underlying entity definitions is relatively rare. Therefore in SPS 09 we enable the option to configure caching of these $metadata documents in order to avoid the many redundant queries to the process the metadata.
service { ... } settings { content cache-control "no-store"; metadata cache-control "max-age=3600,must-revalidate"; }
ETag Support
The OData specification uses ETags for optimistic concurrency control. You can read more about the specification here: https://www.odata.org/documentation/odata-version-2-0/operations/#ConcurrencycontrolandETags
If the developer wants to support this feature in XSODATA, they have to enable it per entity in the .xsodata file. Example:
service { entity "sap.test.odata.db.views::Etag" as "EtagAll" key ("KEY_00") concurrencytoken; entity "sap.test.odata.db.views::Etag" as "EtagNvarchar" key ("KEY_00") concurrencytoken ("NVARCHAR_01","INTEGER_03"); }
If only “concurrencytoken” is specified, all properties, except the key properties, are used to calculate the etag value. If only specific properties are given, only those are used for the calculation. “concurrencytoken” cannot be used on aggregated properties with aggregation method AVG (average).
SAP HANA SPS 09: New Developer Features; New XSODATA
Nullable Properties
All entity properties are automatically generated by the XSODATA layer during create and since they are not nullable, the consumer is now forced to pass dummy values into these property.
However OData supports $filter and $orderby conditions on the “null” value. This means, that it is now possible to treat “null” as a value, if the developer enables it. This behavior can only be enabled for the whole service, not per entity. Example:
service { … } settings { support null; }
Only if this support is enabled, $filter requests like $filter=NVARCHAR_01 eq null are possible. Otherwise “null” is rejected with an exception.
If the support is not enabled, the default behavior applies and all null values are neglected in comparisons and the respective rows are removed from the result (i.e. common database behavior).
Odata Execution Tracking Utility
In order to ease the supportability and analysis of performance for OData request in HANA, we’ve added functionality to request to profile the performance of request processing (executed queries and the time spend in different OData components) in read and write requests. The requested profiling info is then accessible only if the XS engine is in debug mode.
Main usage is – tracking performance by:
1. Add query parameter named ‘profile’ to OData request that notifies the server to produce the report
2. If the parameter is present and engine is in debug mode – OData profiling is done
3. OData response is skipped and the server returns:
HTML page with the collected information in case profile=html (default)
JSON response with the collected info in case profile=json
OData Explorer
The SAP River Application Explorer has been rebuilt as a general SAP OData Explorer in SPS 09. It allows for the general testing and data generation of XSODATA based services. You can view all records in a service or create/delete/edit individual records. It also supports mass generation of multiple records at once with random value generation. It can be launched from the Web-based Development Workbench (via context menu option on XSODATA service) or directly via the url=
/sap/hana/ide/editor/plugin/testtools/odataexplorer/index.html?appName=
New NetWeaver Information at SAP.com
Very Helpfull