Skip to Content
avatar image
Former Member

SAP Gateway (OData) - many-to-many relationship

Hi, all.

I have two entity types - "Client" and "Manager". They have Many-to-Many relationship In our system. I'm modeling this relationship using additional entity - "ClientManagerLink", what "is not beautiful".

Can i model Many-to-Many relation ship without "excess" Link entity?

How to best practices for modeling Many-to-Many relationship?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Sep 07, 2017 at 05:14 AM

    Hi Sergey Chebotarev,

    You can define associations between entities to express relationships between entities:

    1.Basically "Associations" define the relationship between two or more Entity Types like for example, Employee WorksFor Department). Its instances are grouped in Association Sets.

    2."Navigation Properties" are special properties on Entity Types which are bound to a specific association and can be used to refer to associations of an entity.

    PG

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 07, 2017 at 10:00 AM

    Hi,

    While modelling the gateway project, you need to specify the cardinality of the entities in an association. You have an option to choose the cardinality as either M ( 0..n) or N (1..n) for Principal and Dependent Entity.

    BR.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 07, 2017 at 09:27 PM

    Thanks for your answers

    I understand as modeling cardinality one-to-many and many-to-one, but I don't understand modeling cardinality many-to-many.

    I follow your recommendation

    But Manager, have not property for ClientID (see below)

    In my example I need add new entity ManagerClientLink, without this entity I don't may create association.

    Can i modeling Many-to-Many relationship without "excess" Link entity?

    I read these topics

    https://archive.sap.com/discussions/thread/3832655

    https://archive.sap.com/discussions/thread/3660427

    https://stackoverflow.com/questions/34048581/how-to-model-a-many-to-many-relationship-in-sap-netweaver-gateway

    but I do not found answer

    Add comment
    10|10000 characters needed characters exceeded

    • Hi,

      Yeah I think we have other solution to your query ---

      Can i modeling Many-to-Many relationship without "excess" Link entity?

      Such case I may add one field in each entity type so entity Client and Manager will have a common field--- This Common field will maintain a cardinality as well take care of Principle and dependent Property while creating association.

      This might look like below:

      As I think having a extra field in Entity type seems feasible than making a diff entity spcially for reference... -- Not recommended.

      Hope it help,

      Cheers!!

      PG