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.

Table definition sample.odata:table.hdbtable<br />

table.schemaName = "ODATASAMPLES";<br />

table.tableType = COLUMNSTORE;<br />

table.columns = [<br />

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

{name = "Text"; sqlType = NVARCHAR; length=1000;},<br />

{name = "Time"; sqlType = TIMESTAMP;}<br />

];<br />

table.primaryKey.pkcolumns = ["ID"];<br />

Repository Objects<br />

If the object to expose via an OData service is created during an activation in the repository, then it has a<br />

repository design-time representation. Examples for those objects are tables, SQL views and calculation views. An<br />

example for exposing the table above is shown in the next listing.<br />

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

service {<br />

"sample.odata:table.hdbtable" as "MyTable";<br />

}<br />

This service definition exposes a table defined in the .hdbtable file sample.odata:table.hdbtable and<br />

creates an EntitySet for this entity named "MyTable". The specification of an alias is optional. If omitted the<br />

default name of the EntitySet is the name of the repository object file, here "table".<br />

http://localhost:8002/sample/odata/repo.xsodata<br />

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

190<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!