[
https://issues.jboss.org/browse/TEIID-5221?page=com.atlassian.jira.plugin...
]
Steven Hawkins commented on TEIID-5221:
---------------------------------------
Well, I don't have much control over what I get as odata
metadata.
[~jstastny] Then the metadata production may require an issue.
What do I need to do to achieve the implicit match? Rename the FK
column to match the referenced id?
To clarify things where things stand. A ReferentialConstraint will work:
{code}
<EntityType Name="A">
<Key>
<PropertyRef Name="a_id"/>
</Key>
<Property Name="a_id" Type="Edm.Int32"
Nullable="false"/>
<Property Name="a_value" Type="Edm.String"
MaxLength="4000"/>
<NavigationProperty Name="C_FK0"
Type="Collection(data.C)"/>
</EntityType>
<EntityType Name="C">
<Key>
<PropertyRef Name="c_id"/>
</Key>
<Property Name="c_id" Type="Edm.Int32"
Nullable="false"/>
<Property Name="a_ref" Type="Edm.Int32"/>
<NavigationProperty Name="FK0" Type="data.A">
<ReferentialConstraint Property="a_ref"
ReferencedProperty="a_id" />
</NavigationProperty>
</EntityType>
{code}
Only having the collection navigation and renaming the column will work:
{code}
<EntityType Name="A">
<Key>
<PropertyRef Name="a_id"/>
</Key>
<Property Name="a_id" Type="Edm.Int32"
Nullable="false"/>
<Property Name="a_value" Type="Edm.String"
MaxLength="4000"/>
<NavigationProperty Name="C_FK0"
Type="Collection(data.C)"/>
</EntityType>
<EntityType Name="C">
<Key>
<PropertyRef Name="c_id"/>
</Key>
<Property Name="c_id" Type="Edm.Int32"
Nullable="false"/>
<Property Name="a_id" Type="Edm.Int32"/>
</EntityType>
{code}
Unfortunately, if there is both the forward and reverse navigation the logic won't
create the foreign key. So this won't work:
{code}
<EntityType Name="A">
<Key>
<PropertyRef Name="a_id"/>
</Key>
<Property Name="a_id" Type="Edm.Int32"
Nullable="false"/>
<Property Name="a_value" Type="Edm.String"
MaxLength="4000"/>
<NavigationProperty Name="C_FK0"
Type="Collection(data.C)"/>
</EntityType>
<EntityType Name="C">
<Key>
<PropertyRef Name="c_id"/>
</Key>
<Property Name="c_id" Type="Edm.Int32"
Nullable="false"/>
<Property Name="a_id" Type="Edm.Int32"/>
<NavigationProperty Name="FK0" Type="data.A"/>
</EntityType>
{code}
We hadn't seen an example of that last case (as it appears that frameworks generally
assign the ReferentialConstraint), but I'm fine with implementing it.
OData4 Translator generates invalid metadata
---------------------------------------------
Key: TEIID-5221
URL:
https://issues.jboss.org/browse/TEIID-5221
Project: Teiid
Issue Type: Bug
Components: Misc. Connectors, OData
Affects Versions: 8.12
Reporter: Ramesh Reddy
Assignee: Steven Hawkins
Fix For: 10.1, 10.0.3, 9.3.7, 8.12.12.6_4
The OData V4 translator does not generate metadata correctly in situations
1) When multiple navigations are defined on the EnitityType.
2) The PSEDEO column usage is incorrect, as this should be only used with ComplexType
structures when the association to EntityType is made. But this is also used in cases
where incorrect referential constraints are used. This may lead to the additional columns
on Entities which are hard to resolve during the runtime.
3) Usage of MERGE property is also incorrect when multiple navigation properties are
defined as these may be overridden for (1)
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)