Skip to Content

XS OData Services based on XSDS managed entities

Hi,

I wonder if it is possible, to build XS OData Services based on XSDS (XS Data Services) managed entities.

asume a CDS entity named post is defined at .hdbdd file.

CDS

entity post {

key pid: Integer not null;

Title: String(63) not null;

Text: text;

Author: association [1] to user;

Parent: association [0..1] to post;

Rating: Integer;

Created: UTCDateTime;

//Comments: association [0..*] to comment via backlink Parent; //One-to-Many Associations via backlink

//Tags: association [0..*] to ds_comments via entity tags_by_post; //Many-to-Many Associations via entity

Replies: Association[*] to post on Replies.Parent.pid = pid; //Unmanaged Associations (can be defined at XSDS too)

};

XSDS

As One-to-Many Associations via backlink and Many-to-Many Associations via entity are not supported yet at cds, these Associations are defined using XSDS.

var Post = XSDS.$importEntity("sap.hana.democontent.xsds", "bboard.post", {

//One-to-Many Associations

Comments: {

$association: {

$entity: "sap.hana.democontent.xsds::bboard.comment",

$viaBacklink: "Parent"

}

},

// Many-to-Many Associations

Tags: {

$association: {

$entity: "sap.hana.democontent.xsds::bboard.tag",

$viaEntity: "sap.hana.democontent.xsds::bboard.tags_by_post",

$source: "post",

$target: "tag",

}

},

XSOData

so is it possible to create an XS OData service which is based on Post managed entity and inherits all the associations and metadata defined at cds and xsds level?

Kind regards

Rouzbeh

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Jul 25, 2016 at 11:15 AM

    No this is not possible. You have to redefine the entity/associations within the XSODATA service definition. XSODATA only accepts database table, SQL view, and modeled views as its source. You can use XSDS within the Create/Update/Delete exits of an XSODATA service if you wish.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.