cancel
Showing results for 
Search instead for 
Did you mean: 

XS OData Services based on XSDS managed entities

0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

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.

Answers (0)