none
New association lead to invalid multiplicity error RRS feed

  • Question

  • Hello,
    I'm working on a project using EF5 built on top of old Oracle DB (hence using EF5 and not EF6) which we cannot change. The DB is not fully normalized and we have to create many views to compensate for it. The problem is that views do not have FK and we have to create our own associations. We're now in the process of creating our first association and we encounter a problem. Here are the entities we're trying to associate:

    The ProjectWithAsset entity is based on a view. ProjectWithAsset.ProjectSerialNumber is PK and Plant.ProjectSerialNumber is FK to it. These are the association properties and the referential constraint:

    It all seems OK but we get the following error:

    Error 6 Error 113: Multiplicity is not valid in Role 'Plant' in relationship 'V_PROJECTASSETPlant'. Because the Dependent Role refers to the key properties, the upper bound of the multiplicity of the Dependent Role must be 1. 

    What are we doing wrong?

    Thank you,

    Ken

    Friday, June 27, 2014 4:56 AM

Answers

  • Hello,

    >>However, I'm wondering why do you have both OrderId AND View_OrderOrderID as properties of OrderDetails? Shouldn't one be sufficient?

    This column is newly added to the OrderDetail table. I am sorry that makes you confused. Now I delete it and specify the OrderId as the dependent property:

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Ken Saraf Monday, July 7, 2014 2:50 AM
    Thursday, July 3, 2014 1:57 AM
    Moderator

All replies

  • Hello,

    From the designer, I notice that the Plant.ProjectSerialNumber is both foreign key and primary key, is it right? Since I do have an Oracle, but in Sqlsever, this is not allowed because a primary key must be unique in the whole table, while you define that the key is also a foreign key with a one to many relationship which means it could duplicate, this is conflict.

    I don't know what you want to achieve, but you need to define a one-to-one relationship in such scenario.

    If I misunderstand, please let me know.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, June 27, 2014 8:09 AM
    Moderator
  • Hi Fred,

    Thank you for responding. Plant.ProjectSerialNumber is just a FK. The PK in Plant is Plant.PlantSerialNumber. I'm trying to define a one (ProjectWithAsset) to many (Plants) relationship.

    I hope this clarify things.

    Ken

    Friday, June 27, 2014 6:45 PM
  • Hello Ken,

    Thanks for your clarification, from it, I know I have misunderstand you, sorry for that.

    When do you get the error? As your description, I create similar scenario which I can save this model successfully:

    I use the provider working for SQLServer since I don’t have the Oracle database, I am not sure whether the provider for Oracle is different, you could also post it to:

    https://community.oracle.com/communications

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.



    Monday, June 30, 2014 7:38 AM
    Moderator
  • Thank you Fred. Its seems that you were trying to post an image but for some reason I can't see it. Can you please re-post. As the relationship is in the EF model level and not in the DB itself I don't think this is a provider issue. Thank you, Ken
    Monday, June 30, 2014 7:26 PM
  • Hi Ken,

    Oh, sorry for that, I copied and paste it directly rather than uploaded it.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, July 1, 2014 7:21 AM
    Moderator
  • Thanks Fred. One more question: could you please post a screenshots of the association properties and the referential constraints (same as I did above)? I just want to compare to what we did.

    Thank you,

    Ken

    Tuesday, July 1, 2014 6:50 PM
  • Hello,

    Of course. This is the screenshot:

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, July 2, 2014 7:20 AM
    Moderator
  • Thank you Fred.

    I can see now that I set the dependent property in the referential constraint dialogue to PlantSerialNumber instead of ProjectSerialNumber. However, I'm wondering why do you have both OrderId AND View_OrderOrderID as properties of OrderDetails? Shouldn't one be sufficient?

    Thank you,

    Ken

    Wednesday, July 2, 2014 8:25 PM
  • Hello,

    >>However, I'm wondering why do you have both OrderId AND View_OrderOrderID as properties of OrderDetails? Shouldn't one be sufficient?

    This column is newly added to the OrderDetail table. I am sorry that makes you confused. Now I delete it and specify the OrderId as the dependent property:

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Ken Saraf Monday, July 7, 2014 2:50 AM
    Thursday, July 3, 2014 1:57 AM
    Moderator