Uploaded image for project: 'Teiid'
  1. Teiid
  2. TEIID-5559

odata4 NPE when accessing VDB including FK relationship across models

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 12.0, 11.2.1, 8.12.17.6_4
    • 8.12.16.6_4
    • OData
    • None
    • Hide

      1) Deploy VDB [1]
      2) Navigate to fkmodel.fktable like with "http://127.0.0.1:8080/odata4/fktest/fkmodel/fktable"
      3) Observe error

      [1]
      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <vdb name="fktest" version="1">

      <description>test for fk odata NPE</description>
      <model name="pkmodel" type="VIRTUAL">
      <metadata type="DDL"><![CDATA[

      CREATE VIEW pktable (
      id integer,
      keyvalue string,
      CONSTRAINT pkid PRIMARY KEY(id)
      ) OPTIONS (UPDATABLE 'TRUE')
      AS
      SELECT 1 as id, 'a' as keyvalue
      ]]> </metadata>
      </model>
      <model name="fkmodel" type="VIRTUAL">
      <metadata type="DDL"><![CDATA[

      CREATE VIEW fktable (
      id integer,
      fkvalue integer,
      CONSTRAINT pkid PRIMARY KEY(id),
      CONSTRAINT fkid FOREIGN KEY(fkvalue) REFERENCES pkmodel.pktable(id)
      ) OPTIONS(UPDATABLE 'TRUE')
      AS
      SELECT 1 as id, 1 as fkvalue
      ]]> </metadata>
      </model>

      </vdb>

      Show
      1) Deploy VDB [1] 2) Navigate to fkmodel.fktable like with "http://127.0.0.1:8080/odata4/fktest/fkmodel/fktable" 3) Observe error [1] <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <vdb name="fktest" version="1"> <description>test for fk odata NPE</description> <model name="pkmodel" type="VIRTUAL"> <metadata type="DDL"><![CDATA[ CREATE VIEW pktable ( id integer, keyvalue string, CONSTRAINT pkid PRIMARY KEY(id) ) OPTIONS (UPDATABLE 'TRUE') AS SELECT 1 as id, 'a' as keyvalue ]]> </metadata> </model> <model name="fkmodel" type="VIRTUAL"> <metadata type="DDL"><![CDATA[ CREATE VIEW fktable ( id integer, fkvalue integer, CONSTRAINT pkid PRIMARY KEY(id), CONSTRAINT fkid FOREIGN KEY(fkvalue) REFERENCES pkmodel.pktable(id) ) OPTIONS(UPDATABLE 'TRUE') AS SELECT 1 as id, 1 as fkvalue ]]> </metadata> </model> </vdb>

      Receive error [2] when attempting to access table that utilizes a foreign key to another model with URL like [1]. access to the other model (that the foreign key references) works correctly.

      [1] http://127.0.0.1:8080/odata4/fktest/fkmodel/
      [2]
      JBWEB000309: type JBWEB000066: Exception report

      JBWEB000068: message

      JBWEB000069: description JBWEB000145: The server encountered an internal error that prevented it from fulfilling this request.

      JBWEB000070: exception

      org.teiid.core.TeiidRuntimeException
      org.teiid.olingo.service.ODataSchemaBuilder.buildMetadata(ODataSchemaBuilder.java:58)
      org.teiid.olingo.service.OlingoBridge.getHandler(OlingoBridge.java:54)
      org.teiid.olingo.web.ODataFilter.internalDoFilter(ODataFilter.java:228)
      org.teiid.olingo.web.ODataFilter.doFilter(ODataFilter.java:100)
      org.teiid.olingo.web.CorsFilter.doFilter(CorsFilter.java:80)

      JBWEB000071: root cause

      java.lang.NullPointerException
      org.teiid.olingo.service.ODataSchemaBuilder.addReverseNavigation(ODataSchemaBuilder.java:308)
      org.teiid.olingo.service.ODataSchemaBuilder.buildNavigationProperties(ODataSchemaBuilder.java:251)
      org.teiid.olingo.service.ODataSchemaBuilder.buildEntityTypes(ODataSchemaBuilder.java:144)
      org.teiid.olingo.service.ODataSchemaBuilder.buildMetadata(ODataSchemaBuilder.java:54)
      org.teiid.olingo.service.OlingoBridge.getHandler(OlingoBridge.java:54)
      org.teiid.olingo.web.ODataFilter.internalDoFilter(ODataFilter.java:228)
      org.teiid.olingo.web.ODataFilter.doFilter(ODataFilter.java:100)
      org.teiid.olingo.web.CorsFilter.doFilter(CorsFilter.java:80)

              rhn-engineering-shawkins Steven Hawkins
              rhn-support-mshirley Marc Shirley (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: