Skip to Content

How to Create Many-to-Many Relationship Association in xsodata

Hi experts,

I have a Technology table and a Project table. The relationship between two of them are many-to-many. A project can used multiple technologies and a technology can be used in different projects. Thus I also have a relationship table Project_Technology. Its primary keys are PId and TId. I created a xsodata file to expose the data. However I'm getting syntax error on the association. Any thoughts would be helpful.

service {
    "PROJECT_EXPLORER"."Technology" as "Technologies";
    "PROJECT_EXPLORER"."Project" as "Projects" navigates ("Projects_Technologies" as "Has");
    association "Projects_Technologies" with referential constraint principal "Projects"("Id") multiplicity "*" dependent "Technologies"("Id") multiplicity "*" 
        over "PROJECT_EXPLORER"."Project_Technology" principal ("PId") dependent ("TId");
}
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Apr 11 at 07:17 PM

    Hi

    Are you doing this on XSC or XSA?

    Here is a sample from the Hana Developer Guide that is know to work:

    service {
     "sample.odata::customer" as "Customers";
     "sample.odata::order" as "Orders";
     association "Customer_Orders"
     principal "Customers"("ID") multiplicity "*"
     dependent "Customers"("ID") multiplicity "*"
     over "sample.odata::knows" principal ("KnowingCustomerID") dependent ("KnownCustomerID");
    } 

    Main differences are: no navigates clause and the table name references using colon notation.

    Have you tried removing the navigates clause? And what about the table names?

    Regards,
    Ivan

    Add comment
    10|10000 characters needed characters exceeded