Uploaded image for project: 'Olingo'
  1. Olingo
  2. OLINGO-1020

Association Multiplicity cannot set to 0..1 just 1

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • V2 2.0.7
    • V2 2.0.8
    • odata2-jpa
    • None

    Description

      Association Multiplicity cannot set to 0..1 just 1

      We created some navigation like the following (in the many side):
      @ManyToOne
      @PrimaryKeyJoinColumn(name = "SIDE_ONE_OBJECT_ID")
      private OneObject parentOneObject;

      and from the other side:
      @OneToMany(mappedBy = "parentOneObject")
      private List<ManyObject> manyObjects;

      but it creates the following part of the metadata:
      <Association Name="ManyObject_OneObject_One_Many0">
      <End Type="Service.ManyObject" Multiplicity="*" Role="ManyObject"/>
      <End Type="Service.OneObject" Multiplicity="1" Role="OneObject"/>
      </Association>

      We would like to see in the one side the 0..1 multiplicity, so we changed the annotations to the following:
      @ManyToOne(optional = true)
      @JoinColumn(name = "ACTION_PARENT_WORK_PACKAGE_ID", insertable = false, updatable = false, nullable = true)
      private OneObject parentOneObject;

      and from the other side:
      @OneToMany(mappedBy = "parentOneObject")
      private List<ManyObject> manyObjects;

      We expected the following result in metadata:
      <Association Name="ManyObject_OneObject_One_Many0">
      <End Type="Service.ManyObject" Multiplicity="*" Role="ManyObject"/>
      <End Type="Service.OneObject" Multiplicity="0..1" Role="OneObject"/>
      </Association>

      But it did not bring us the expected behaviour and the corresponding part of the metadata remained the same.
      The 0..1 is accesible via the EdmMultiplicity.ZERO_TO_ONE enum, and it is part of the OData documentation.

      Attachments

        Activity

          People

            mirbo mibo
            ZoltanBeleznay Zoltan Beleznay
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: