28.01.2013 Views

SAP HANA Developer Guide - Get a Free Blog

SAP HANA Developer Guide - Get a Free Blog

SAP HANA Developer Guide - Get a Free Blog

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

"1" dependent "Orders"("CustomerID") multiplicity "*";<br />

}<br />

The example above says that it is possible to navigate from Customers over the association<br />

Customer_Order via the NavigationProperty named "HisOrders".<br />

The right association end is determined automatically by the entity set name. But if both ends are bound to the<br />

same entity, it is necessary to specify the starting end for the navigation. This is done by specifying either from<br />

principal or from dependent which refer to the principal and dependent ends in the association.<br />

Service definition: sample.odata:assocnavself.xsodata<br />

service {<br />

"sample.odata:customer.hdbtable" as "Customers"<br />

navigates ("Customer_Orders" as "HisOrders","Customer_Recruit" as<br />

"Recruit" from principal);<br />

"sample.odata:order.hdbtable" as "Orders";<br />

association "Customer_Orders" principal "Customers"("ID") multiplicity<br />

"1" dependent "Orders"("CustomerID") multiplicity "*";<br />

association "Customer_Recruit" principal "Customers"("ID")<br />

multiplicity "1" dependent "Customers"("RecruitID") multiplicity "*";<br />

}<br />

In both cases a NavigationProperty is added to the EntityType.<br />

http://localhost:8002/sample/odata/assocnavself.xsodata/$metadata<br />

OData Aggregation<br />

The results of aggregations on columns change dynamically depending on the grouping conditions. This means<br />

that aggregation cannot be performed in SQL views; it needs to be specified in the OData service definition itself.<br />

Depending on the type of object to expose, you need to explicitly specify the columns to aggregate and the<br />

function to use or derived them from metadata in the database.<br />

In general, aggregations do not have consequences for the metadata document. It just effects the semantics of<br />

the concerning properties during runtime. The grouping condition for the aggregation contain all selected nonaggregated<br />

properties. Furthermore, aggregated columns cannot be used in $filter, and aggregation is only<br />

possible with generated keys.<br />

<strong>SAP</strong> <strong>HANA</strong> <strong>Developer</strong> <strong>Guide</strong><br />

Defining Web-based Data Access<br />

P U B L I C<br />

© 2012 <strong>SAP</strong> AG. All rights reserved. 199

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!