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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Expose an object using the object's repository (design-time) name in the OData service-definition file. This<br />

method of exposing database objects by OData has the advantage that the OData service is automatically<br />

updated if the underlying repository object changes.<br />

● Database objects<br />

Expose an object using the object's database catalog (runtime) name (along with the schema name). The<br />

support for database objects is mainly intended for existing or replicated objects that do not have a repository<br />

design-time representation.<br />

Note: Although both declaration methods are supported, the recommended method is to use the<br />

repository name of the object(s) you want to expose using OData.<br />

OData Service-Definition Type Mapping<br />

During the activation of the OData service definition, SQL types are mapped to EDM types according to a mapping<br />

table. For example, the SQL type "Time" is mapped to the EDM type "EDM.Time"; the SQL type "Decimal" is<br />

mapped to the EDM type "EDM.Decimal"; the SQL types "Real" and "Float" are mapped to the EDM type<br />

"EDM.Single".<br />

In the following example, the SQL types of columns in a table are mapped to the EDM types in the properties of an<br />

entity type.<br />

{name = "ID"; sqlType = INTEGER; nullable = false;}, {name = "RefereeID";<br />

sqlType = VARCHAR; nullable = true;}<br />

<br />

OData Service-Definition Features<br />

The OData service definition provides a list of keywords that you use in the OData service-definition file to enable<br />

important features. For example, the following list illustrates the most-commonly used features used in an OData<br />

service-definition and, where appropriate, indicates the keyword to use to enable the feature:<br />

● Aggregation<br />

The results of aggregations on columns change dynamically, depending on the grouping conditions. As a<br />

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

Depending on the type of object you want to expose with OData, the columns to aggregate and the function<br />

used must be specified explicitly (explicit aggregation) or derived from metadata in the database (derived<br />

aggregation). Note that aggregated columns cannot be used in combination with the $filter query<br />

parameter, and aggregation is only possible with generated keys.<br />

● Association<br />

Define associations between entities to express relationships between entities. With associations it is possible<br />

to reflect foreign key constraints on database tables, hierarchies and other relations between database<br />

objects.<br />

● Key Specification<br />

166<br />

P U B L I C<br />

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

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

Defining Web-based Data Access

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

Saved successfully!

Ooh no, something went wrong!