You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@olingo.apache.org by Shabtay Gertzek <sh...@thetts.com> on 2016/06/06 07:38:03 UTC

Inherited property not recognized as navigation property in Olingo OData 2

Hi,

Here is a parent class:

@MappedSuperclass

public abstract class FacilityChildBase {

 

    @ManyToOne(fetch = FetchType.LAZY)

    @JoinColumn(name = "facility_id", nullable = false)

    @Parent

    private Facility facility;

 

    // Other fields, getters and setters ...

}

The device class is derived from FacilityChildBase:

@Entity

@Table(name = "device")

@AccessControled

public class Device extends FacilityChildBase {

    @ManyToOne(fetch = FetchType.LAZY)

    @JoinColumn(name = "device_descriptor_id", nullable = false)

    private DeviceDescriptor deviceDescriptor;

 

    @ManyToOne(fetch = FetchType.LAZY)

    @JoinColumn(name = "area_id", nullable = true)

    private Area area;

 

    @ManyToOne(fetch = FetchType.LAZY)

    @JoinColumn(name = "lane_id", nullable = true)

    private Lane lane;

 

    public Device() {}

 

    // other fields, getters and setters...

}

The metadata generated by OData2 (Olingo) for the above structure is:

    <EntityType Name="Device">

        <Key>

            <PropertyRef Name="Id"/>

        </Key>

        <Property Name="Area" Type="Edm.Int32" Nullable="true"/>

        <Property Name="DeviceDescriptor" Type="Edm.Int32"
Nullable="false"/>

        <Property Name="Facility" Type="Edm.Int32" Nullable="false"/>

        <Property Name="Id" Type="Edm.Int32" Nullable="false"/>

        <Property Name="Lane" Type="Edm.Int32" Nullable="true"/>

        <NavigationProperty Name="AreaDetails"
Relationship="all-in-one.Area_Device_One_Many0" FromRole="Device"
ToRole="Area"/>

        <NavigationProperty Name="DeviceDescriptorDetails"
Relationship="all-in-one.Device_DeviceDescriptor_Many_One0"
FromRole="Device" ToRole="DeviceDescriptor"/>

        <NavigationProperty Name="LaneDetails"
Relationship="all-in-one.Lane_Device_One_Many0" FromRole="Device"
ToRole="Lane"/>

    </EntityType>

One would expect OData to generate four navigation properties, for Area,
DeviceDescriptor, Facility, and Lane. However, OData identifies only three
such properties. It fails to mark Facility as a navigation property as well.
The only difference I can see is that Facility is inherited from the parent
class, while the other three are attributes of the derived class.

How can I make OData2 to identify the inherited property as a navigational
property as well?

Any help will be appreciated. 

Thanks, 
Shabtay