Nikolay Grechanov created OLINGO-1242: -----------------------------------------
Summary: Property and referential constraint are missing when @ManyToOne(fetch = EAGER) Key: OLINGO-1242 URL: https://issues.apache.org/jira/browse/OLINGO-1242 Project: Olingo Issue Type: Bug Components: odata2-jpa Affects Versions: V2 2.0.10 Environment: Java EE 7 (TomEE) Server, Java 8, EclipseLink 2.5.2 Reporter: Nikolay Grechanov In my JPA model I have the following property: {code:java} @ManyToOne(fetch = EAGER, optional = false) @BatchFetch(JOIN) @NotNull @JoinColumn(name = "PARENT_ID", nullable = false) @JsonProperty(PARENT_DETAILS) @JsonSerialize(using = ODataDeferredSerializer.class) private Parent parent;{code} $metadata contains Parent property as well as referential constraint for association: {code:java} ... <EntityType Name="Child"> <Key> <PropertyRef Name="Id"/> </Key> <Property Name="Parent" Type="Edm.Int64" Nullable="false"/> <NavigationProperty Name="ParentDetails" Relationship="myProject.Child_Parent_Many_One0" FromRole="Child" ToRole="Parent"/> </EntityType> ... <Association Name="Child_Parent_Many_One0"> <End Type="myProject.Child" Multiplicity="*" Role="Child"/> <End Type="myProject.Parent" Multiplicity="1" Role="Parent"/> <ReferentialConstraint> <Principal Role="Parent"> <PropertyRef Name="Id"/> </Principal> <Dependent Role="Child"> <PropertyRef Name="Parent"/> </Dependent> </ReferentialConstraint> </Association> ...{code} When I set {code:java} @ManyToOne(fetch = LAZY, optional = false){code} then $metadata contains _neither_ Parent property _nor_ referential constraint for the association: {code:java} ... <EntityType Name="Child"> <Key> <PropertyRef Name="Id"/> </Key> <NavigationProperty Name="ParentDetails" Relationship="myProject.Child_Parent_Many_One0" FromRole="Child" ToRole="Parent"/> </EntityType> ... <Association Name="Child_Parent_Many_One0"> <End Type="myProject.Child" Multiplicity="*" Role="Child"/> <End Type="myProject.Parent" Multiplicity="1" Role="Parent"/> </Association> ...{code} ManyToOne.optional, NonNull, JoinColumn.nullable annotation values have no effect -- This message was sent by Atlassian JIRA (v7.6.3#76005)