[teiid-issues] [JBoss JIRA] (TEIID-5221) OData4 Translator generates invalid metadata

Jan Stastny (JIRA) issues at jboss.org
Tue Feb 27 09:14:00 EST 2018


    [ https://issues.jboss.org/browse/TEIID-5221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13538893#comment-13538893 ] 

Jan Stastny commented on TEIID-5221:
------------------------------------

[~shawkins] There are no foreign keys being imported in 8.12.12.6_4. Tested with commits up to (including) 84cbf16b.
For following odata4 metadata:
{code:xml}
<?xml version="1.0" encoding="UTF-8"?>
<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
  <edmx:Reference Uri="http://localhost:8080/odata4/static/org.apache.olingo.v1.xml">
    <edmx:Include Namespace="org.apache.olingo.v1" Alias="olingo-extensions"/>
  </edmx:Reference>
  <edmx:DataServices>
    <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="teiid5221data.1.data" Alias="data">
      <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="B">
        <Key>
          <PropertyRef Name="b_id"/>
        </Key>
        <Property Name="b_id" Type="Edm.Int32" Nullable="false"/>
        <Property Name="b_value" Type="Edm.String" MaxLength="4000"/>
        <NavigationProperty Name="C_FK1" 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"/>
        <Property Name="b_ref" Type="Edm.Int32"/>
        <NavigationProperty Name="FK0" Type="data.A"/>
        <NavigationProperty Name="FK1" Type="data.B"/>
      </EntityType>
      <EntityContainer Name="data">
        <EntitySet Name="A" EntityType="data.A">
          <NavigationPropertyBinding Path="C_FK0" Target="C"/>
        </EntitySet>
        <EntitySet Name="B" EntityType="data.B">
          <NavigationPropertyBinding Path="C_FK1" Target="C"/>
        </EntitySet>
        <EntitySet Name="C" EntityType="data.C">
          <NavigationPropertyBinding Path="FK0" Target="A"/>
          <NavigationPropertyBinding Path="FK1" Target="B"/>
        </EntitySet>
      </EntityContainer>
    </Schema>
  </edmx:DataServices>
</edmx:Edmx>
{code}

I get this metadata imported:
{code:sql}
===> SET NAMESPACE 'http://www.jboss.org/teiiddesigner/ext/odata/2012' AS teiid_odata;

CREATE FOREIGN TABLE A (
	a_id integer NOT NULL OPTIONS (NATIVE_TYPE 'Edm.Int32'),
	a_value string,
	PRIMARY KEY(a_id)
) OPTIONS (UPDATABLE TRUE, "teiid_odata:NameInSchema" 'data.A', "teiid_odata:Type" 'ENTITY_COLLECTION');

CREATE FOREIGN TABLE B (
	b_id integer NOT NULL OPTIONS (NATIVE_TYPE 'Edm.Int32'),
	b_value string,
	PRIMARY KEY(b_id)
) OPTIONS (UPDATABLE TRUE, "teiid_odata:NameInSchema" 'data.B', "teiid_odata:Type" 'ENTITY_COLLECTION');

CREATE FOREIGN TABLE C (
	c_id integer NOT NULL OPTIONS (NATIVE_TYPE 'Edm.Int32'),
	a_ref integer OPTIONS (NATIVE_TYPE 'Edm.Int32'),
	b_ref integer OPTIONS (NATIVE_TYPE 'Edm.Int32'),
	PRIMARY KEY(c_id)
) OPTIONS (UPDATABLE TRUE, "teiid_odata:NameInSchema" 'data.C', "teiid_odata:Type" 'ENTITY_COLLECTION');
{code}

> 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)


More information about the teiid-issues mailing list