[JBoss JIRA] (TEIID-4064) OData - missing non-nullable property
by Juraj Duráni (JIRA)
[ https://issues.jboss.org/browse/TEIID-4064?page=com.atlassian.jira.plugin... ]
Juraj Duráni commented on TEIID-4064:
-------------------------------------
Id do not think there is problem with serialization. Point is, that if names of the "id" columns are different, then no exception is thrown. Maybe problem is that Teiid is trying to set "id" to Customer but uses ResultSet.getInt(String) method. But, which column should method return? There are two columns with name "id". And maybe Teiid gets from this method "null" (resp. wasNull() returns true) and therefore Customer's "id" is set to "null" and serialization cannot build Entity.
Note that I did not check the source code so I am only guessing.
> OData - missing non-nullable property
> -------------------------------------
>
> Key: TEIID-4064
> URL: https://issues.jboss.org/browse/TEIID-4064
> Project: Teiid
> Issue Type: Sub-task
> Components: OData
> Reporter: Juraj Duráni
> Assignee: Ramesh Reddy
>
> Change DDL for tables Customer and Orders in VDB as follows:
> {code:sql}
> CREATE FOREIGN TABLE Customers (
> id integer PRIMARY KEY OPTIONS (NAMEINSOURCE 'id'),
> name varchar(10)) OPTIONS (NAMEINSOURCE 'DB.PUBLIC.CUSTOMERS');
> CREATE FOREIGN TABLE Orders (
> id integer PRIMARY KEY OPTIONS (NAMEINSOURCE 'id'),
> customerid integer,
> place varchar(10),
> FOREIGN KEY (customerid) REFERENCES Customers(id)) OPTIONS (NAMEINSOURCE 'DB.PUBLIC.ORDERS');
> {code}
> Note, that both tables have same name of primary key named "id".
> Invoke GET method to URL http://localhost:8080/odata4/olingo_basic/Source/Customers/?$count=true&$...
> *Result:*
> {code:xml}
> <error>
> <code>400</code>
> <message>The non-nullable property 'id' is missing.</message>
> </error>
> {code}
> Here are selected part of Teiid's log:
> *Query:*
> {code:sql}
> SELECT g10.id, g10.name, g11.id, g11.customerid, g11.place FROM Source.Customers AS g10 LEFT OUTER JOIN Source.Orders AS g11 ON g10.id = g11.customerid ORDER BY g10.id
> {code}
> *Result:*
> |id|name|id|customerid|place|
> |1|customer1|1|1|town|
> |1|customer1|2|1|state|
> |1|customer1|3|1|country|
> |1|customer1|4|1|abroad|
> |2|customer2|5|2|state|
> |2|customer2|6|2|country|
> |3|customer3|7|3|town|
> |3|customer3|8|3|town|
> |4|customer4|<null>|<null>|<null>|
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
10 years
[JBoss JIRA] (TEIID-4064) OData - missing non-nullable property
by Ramesh Reddy (JIRA)
[ https://issues.jboss.org/browse/TEIID-4064?page=com.atlassian.jira.plugin... ]
Ramesh Reddy commented on TEIID-4064:
-------------------------------------
[~jdurani] The serializers are strict in checking if the property that is marked as non-null and null values are provided. I am not sure there is much we can do.
> OData - missing non-nullable property
> -------------------------------------
>
> Key: TEIID-4064
> URL: https://issues.jboss.org/browse/TEIID-4064
> Project: Teiid
> Issue Type: Sub-task
> Components: OData
> Reporter: Juraj Duráni
> Assignee: Ramesh Reddy
>
> Change DDL for tables Customer and Orders in VDB as follows:
> {code:sql}
> CREATE FOREIGN TABLE Customers (
> id integer PRIMARY KEY OPTIONS (NAMEINSOURCE 'id'),
> name varchar(10)) OPTIONS (NAMEINSOURCE 'DB.PUBLIC.CUSTOMERS');
> CREATE FOREIGN TABLE Orders (
> id integer PRIMARY KEY OPTIONS (NAMEINSOURCE 'id'),
> customerid integer,
> place varchar(10),
> FOREIGN KEY (customerid) REFERENCES Customers(id)) OPTIONS (NAMEINSOURCE 'DB.PUBLIC.ORDERS');
> {code}
> Note, that both tables have same name of primary key named "id".
> Invoke GET method to URL http://localhost:8080/odata4/olingo_basic/Source/Customers/?$count=true&$...
> *Result:*
> {code:xml}
> <error>
> <code>400</code>
> <message>The non-nullable property 'id' is missing.</message>
> </error>
> {code}
> Here are selected part of Teiid's log:
> *Query:*
> {code:sql}
> SELECT g10.id, g10.name, g11.id, g11.customerid, g11.place FROM Source.Customers AS g10 LEFT OUTER JOIN Source.Orders AS g11 ON g10.id = g11.customerid ORDER BY g10.id
> {code}
> *Result:*
> |id|name|id|customerid|place|
> |1|customer1|1|1|town|
> |1|customer1|2|1|state|
> |1|customer1|3|1|country|
> |1|customer1|4|1|abroad|
> |2|customer2|5|2|state|
> |2|customer2|6|2|country|
> |3|customer3|7|3|town|
> |3|customer3|8|3|town|
> |4|customer4|<null>|<null>|<null>|
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
10 years
[JBoss JIRA] (TEIID-4033) View model - named attributes in mapping statement are not automatically mapped to the corresponding column in the table definition
by Steven Hawkins (JIRA)
[ https://issues.jboss.org/browse/TEIID-4033?page=com.atlassian.jira.plugin... ]
Steven Hawkins resolved TEIID-4033.
-----------------------------------
Resolution: Rejected
Unless I'm not understanding clearly, this is still rejected.
Issue:
CREATE VIEW MYVIEW_COLUMNS_SWITCH (one, two) AS SELECT 2 AS TWO, 1 AS ONE;
In postgresql, h2, sql server, etc. and then issue "select * from MYVIEW_COLUMNS_SWITCH" and confirm that column one has value 2, and column two has value 1. This is expected behavior. Is there a specific example of what 4GL system or ANSI sql spec compliance we are shooting for here?
> View model - named attributes in mapping statement are not automatically mapped to the corresponding column in the table definition
> -----------------------------------------------------------------------------------------------------------------------------------
>
> Key: TEIID-4033
> URL: https://issues.jboss.org/browse/TEIID-4033
> Project: Teiid
> Issue Type: Feature Request
> Components: VDB
> Affects Versions: 8.7.2.6_2
> Environment: Dynamic VDB:
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <vdb name="dollar" version="1">
> <description/>
> <property name="validationDateTime" value="Tue Mar 08 07:37:23 CST 2016"/>
> <property name="validationVersion" value="8.7.3"/>
> <model name="SOURCE_MODEL">
> <source connection-jndi-name="Debbie2" name="Debbie2" translator-name="postgresql"/>
> <metadata type="DDL"><![CDATA[
> CREATE FOREIGN TABLE mytable (
> id integer NOT NULL OPTIONS(NAMEINSOURCE '"id"', NATIVE_TYPE 'int4', CASE_SENSITIVE 'FALSE', FIXED_LENGTH 'TRUE', SEARCHABLE 'ALL_EXCEPT_LIKE'),
> name string(40) OPTIONS(NAMEINSOURCE '"name"', NATIVE_TYPE 'text'),
> age integer OPTIONS(NAMEINSOURCE '"age"', NATIVE_TYPE 'int4', CASE_SENSITIVE 'FALSE', FIXED_LENGTH 'TRUE', SEARCHABLE 'ALL_EXCEPT_LIKE'),
> address string(200) OPTIONS(NAMEINSOURCE '"address"', NATIVE_TYPE 'text'),
> CONSTRAINT pk_mytableid PRIMARY KEY(id)
> ) OPTIONS(NAMEINSOURCE '"public"."mytable"', CARDINALITY '3')
> ]]></metadata>
> </model>
> <model name="VIEW_MODEL" type="VIRTUAL">
> <metadata type="DDL"><![CDATA[
> CREATE VIEW MY_VIEW (
> ID integer NOT NULL,
> NAME string(40),
> ADDRESS string(200),
> CONSTRAINT FKI_MY_VIEW PRIMARY KEY(ID)
> )
> AS
> SELECT "ID" as ID, "ADDRESS" as ADDRESS, "NAME" as NAME FROM SOURCE_MODEL.mytable;
> ]]></metadata>
> </model>
> </vdb>
> Reporter: Debbie Steigner
> Assignee: Barry LaFond
>
> Unexpected sequential dependency between virtual table column order and mapping column sequence.
> The TEIID statement to create a virtual table goes like:
> CREATE VIEW TargetModelViewName (
> ColumnA … 1
> ColumnB … 2
> ColumnC …) … 3
> AS SELECT
> SourceModel.SourceTable.ColX AS ColumnA, 1
> SourceModel.SourceTable.ColY AS ColumnB, 2
> SourceModel.SourceTable.ColZ AS ColumnC; 3
> In any 4th+ generation query language a positional dependency is not expected, and therefore the following statement should also work, but fails in the TEIID
> CREATE VIEW TargetModelViewName (
> ColumnA … 1
> ColumnB … 2
> ColumnC …) … 3
> AS SELECT
> SourceModel.SourceTable.ColX AS ColumnA, 1
> SourceModel.SourceTable.ColZ AS ColumnC, 3
> SourceModel.SourceTable.ColY AS ColumnB; 2
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
10 years
[JBoss JIRA] (TEIID-4033) View model - named attributes in mapping statement are not automatically mapped to the corresponding column in the table definition
by Debbie Steigner (JIRA)
[ https://issues.jboss.org/browse/TEIID-4033?page=com.atlassian.jira.plugin... ]
Debbie Steigner commented on TEIID-4033:
----------------------------------------
Switching to a Feature Request - the current behavior is not in line with a 4GL point of view and has some quality flaws.
See attached example , in which I define the view as :
CREATE VIEW MYVIEW_COLUMNS_SWITCH (
ID string,
ONE string,
TWO string,
constraint PK_MYVIEW primary key (ID)
) AS SELECT ID AS ID, TWO AS TWO, ONE AS ONE FROM MYSOURCE;
When deployed, and perform 'SELECT * FROM MYVIEW_COLUMNS_SWITCH', the content of the SOURCE column 'TWO' is shown in the MYVIEW column 'ONE'.
-->This is incorrect behavior.
ID ONE TWO
---------- --- ---
ID94039401 2 1
To resolve this, the correct "AS" column should be matched to the corresponding "VIEW" column .
> View model - named attributes in mapping statement are not automatically mapped to the corresponding column in the table definition
> -----------------------------------------------------------------------------------------------------------------------------------
>
> Key: TEIID-4033
> URL: https://issues.jboss.org/browse/TEIID-4033
> Project: Teiid
> Issue Type: Feature Request
> Components: VDB
> Affects Versions: 8.7.2.6_2
> Environment: Dynamic VDB:
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <vdb name="dollar" version="1">
> <description/>
> <property name="validationDateTime" value="Tue Mar 08 07:37:23 CST 2016"/>
> <property name="validationVersion" value="8.7.3"/>
> <model name="SOURCE_MODEL">
> <source connection-jndi-name="Debbie2" name="Debbie2" translator-name="postgresql"/>
> <metadata type="DDL"><![CDATA[
> CREATE FOREIGN TABLE mytable (
> id integer NOT NULL OPTIONS(NAMEINSOURCE '"id"', NATIVE_TYPE 'int4', CASE_SENSITIVE 'FALSE', FIXED_LENGTH 'TRUE', SEARCHABLE 'ALL_EXCEPT_LIKE'),
> name string(40) OPTIONS(NAMEINSOURCE '"name"', NATIVE_TYPE 'text'),
> age integer OPTIONS(NAMEINSOURCE '"age"', NATIVE_TYPE 'int4', CASE_SENSITIVE 'FALSE', FIXED_LENGTH 'TRUE', SEARCHABLE 'ALL_EXCEPT_LIKE'),
> address string(200) OPTIONS(NAMEINSOURCE '"address"', NATIVE_TYPE 'text'),
> CONSTRAINT pk_mytableid PRIMARY KEY(id)
> ) OPTIONS(NAMEINSOURCE '"public"."mytable"', CARDINALITY '3')
> ]]></metadata>
> </model>
> <model name="VIEW_MODEL" type="VIRTUAL">
> <metadata type="DDL"><![CDATA[
> CREATE VIEW MY_VIEW (
> ID integer NOT NULL,
> NAME string(40),
> ADDRESS string(200),
> CONSTRAINT FKI_MY_VIEW PRIMARY KEY(ID)
> )
> AS
> SELECT "ID" as ID, "ADDRESS" as ADDRESS, "NAME" as NAME FROM SOURCE_MODEL.mytable;
> ]]></metadata>
> </model>
> </vdb>
> Reporter: Debbie Steigner
> Assignee: Barry LaFond
>
> Unexpected sequential dependency between virtual table column order and mapping column sequence.
> The TEIID statement to create a virtual table goes like:
> CREATE VIEW TargetModelViewName (
> ColumnA … 1
> ColumnB … 2
> ColumnC …) … 3
> AS SELECT
> SourceModel.SourceTable.ColX AS ColumnA, 1
> SourceModel.SourceTable.ColY AS ColumnB, 2
> SourceModel.SourceTable.ColZ AS ColumnC; 3
> In any 4th+ generation query language a positional dependency is not expected, and therefore the following statement should also work, but fails in the TEIID
> CREATE VIEW TargetModelViewName (
> ColumnA … 1
> ColumnB … 2
> ColumnC …) … 3
> AS SELECT
> SourceModel.SourceTable.ColX AS ColumnA, 1
> SourceModel.SourceTable.ColZ AS ColumnC, 3
> SourceModel.SourceTable.ColY AS ColumnB; 2
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
10 years
[JBoss JIRA] (TEIID-4033) View model - named attributes in mapping statement are not automatically mapped to the corresponding column in the table definition
by Debbie Steigner (JIRA)
[ https://issues.jboss.org/browse/TEIID-4033?page=com.atlassian.jira.plugin... ]
Debbie Steigner updated TEIID-4033:
-----------------------------------
Issue Type: Feature Request (was: Bug)
> View model - named attributes in mapping statement are not automatically mapped to the corresponding column in the table definition
> -----------------------------------------------------------------------------------------------------------------------------------
>
> Key: TEIID-4033
> URL: https://issues.jboss.org/browse/TEIID-4033
> Project: Teiid
> Issue Type: Feature Request
> Components: VDB
> Affects Versions: 8.7.2.6_2
> Environment: Dynamic VDB:
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <vdb name="dollar" version="1">
> <description/>
> <property name="validationDateTime" value="Tue Mar 08 07:37:23 CST 2016"/>
> <property name="validationVersion" value="8.7.3"/>
> <model name="SOURCE_MODEL">
> <source connection-jndi-name="Debbie2" name="Debbie2" translator-name="postgresql"/>
> <metadata type="DDL"><![CDATA[
> CREATE FOREIGN TABLE mytable (
> id integer NOT NULL OPTIONS(NAMEINSOURCE '"id"', NATIVE_TYPE 'int4', CASE_SENSITIVE 'FALSE', FIXED_LENGTH 'TRUE', SEARCHABLE 'ALL_EXCEPT_LIKE'),
> name string(40) OPTIONS(NAMEINSOURCE '"name"', NATIVE_TYPE 'text'),
> age integer OPTIONS(NAMEINSOURCE '"age"', NATIVE_TYPE 'int4', CASE_SENSITIVE 'FALSE', FIXED_LENGTH 'TRUE', SEARCHABLE 'ALL_EXCEPT_LIKE'),
> address string(200) OPTIONS(NAMEINSOURCE '"address"', NATIVE_TYPE 'text'),
> CONSTRAINT pk_mytableid PRIMARY KEY(id)
> ) OPTIONS(NAMEINSOURCE '"public"."mytable"', CARDINALITY '3')
> ]]></metadata>
> </model>
> <model name="VIEW_MODEL" type="VIRTUAL">
> <metadata type="DDL"><![CDATA[
> CREATE VIEW MY_VIEW (
> ID integer NOT NULL,
> NAME string(40),
> ADDRESS string(200),
> CONSTRAINT FKI_MY_VIEW PRIMARY KEY(ID)
> )
> AS
> SELECT "ID" as ID, "ADDRESS" as ADDRESS, "NAME" as NAME FROM SOURCE_MODEL.mytable;
> ]]></metadata>
> </model>
> </vdb>
> Reporter: Debbie Steigner
> Assignee: Barry LaFond
>
> Unexpected sequential dependency between virtual table column order and mapping column sequence.
> The TEIID statement to create a virtual table goes like:
> CREATE VIEW TargetModelViewName (
> ColumnA … 1
> ColumnB … 2
> ColumnC …) … 3
> AS SELECT
> SourceModel.SourceTable.ColX AS ColumnA, 1
> SourceModel.SourceTable.ColY AS ColumnB, 2
> SourceModel.SourceTable.ColZ AS ColumnC; 3
> In any 4th+ generation query language a positional dependency is not expected, and therefore the following statement should also work, but fails in the TEIID
> CREATE VIEW TargetModelViewName (
> ColumnA … 1
> ColumnB … 2
> ColumnC …) … 3
> AS SELECT
> SourceModel.SourceTable.ColX AS ColumnA, 1
> SourceModel.SourceTable.ColZ AS ColumnC, 3
> SourceModel.SourceTable.ColY AS ColumnB; 2
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
10 years
[JBoss JIRA] (TEIID-4033) View model - named attributes in mapping statement are not automatically mapped to the corresponding column in the table definition
by Debbie Steigner (JIRA)
[ https://issues.jboss.org/browse/TEIID-4033?page=com.atlassian.jira.plugin... ]
Debbie Steigner reopened TEIID-4033:
------------------------------------
> View model - named attributes in mapping statement are not automatically mapped to the corresponding column in the table definition
> -----------------------------------------------------------------------------------------------------------------------------------
>
> Key: TEIID-4033
> URL: https://issues.jboss.org/browse/TEIID-4033
> Project: Teiid
> Issue Type: Bug
> Components: VDB
> Affects Versions: 8.7.2.6_2
> Environment: Dynamic VDB:
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <vdb name="dollar" version="1">
> <description/>
> <property name="validationDateTime" value="Tue Mar 08 07:37:23 CST 2016"/>
> <property name="validationVersion" value="8.7.3"/>
> <model name="SOURCE_MODEL">
> <source connection-jndi-name="Debbie2" name="Debbie2" translator-name="postgresql"/>
> <metadata type="DDL"><![CDATA[
> CREATE FOREIGN TABLE mytable (
> id integer NOT NULL OPTIONS(NAMEINSOURCE '"id"', NATIVE_TYPE 'int4', CASE_SENSITIVE 'FALSE', FIXED_LENGTH 'TRUE', SEARCHABLE 'ALL_EXCEPT_LIKE'),
> name string(40) OPTIONS(NAMEINSOURCE '"name"', NATIVE_TYPE 'text'),
> age integer OPTIONS(NAMEINSOURCE '"age"', NATIVE_TYPE 'int4', CASE_SENSITIVE 'FALSE', FIXED_LENGTH 'TRUE', SEARCHABLE 'ALL_EXCEPT_LIKE'),
> address string(200) OPTIONS(NAMEINSOURCE '"address"', NATIVE_TYPE 'text'),
> CONSTRAINT pk_mytableid PRIMARY KEY(id)
> ) OPTIONS(NAMEINSOURCE '"public"."mytable"', CARDINALITY '3')
> ]]></metadata>
> </model>
> <model name="VIEW_MODEL" type="VIRTUAL">
> <metadata type="DDL"><![CDATA[
> CREATE VIEW MY_VIEW (
> ID integer NOT NULL,
> NAME string(40),
> ADDRESS string(200),
> CONSTRAINT FKI_MY_VIEW PRIMARY KEY(ID)
> )
> AS
> SELECT "ID" as ID, "ADDRESS" as ADDRESS, "NAME" as NAME FROM SOURCE_MODEL.mytable;
> ]]></metadata>
> </model>
> </vdb>
> Reporter: Debbie Steigner
> Assignee: Barry LaFond
>
> Unexpected sequential dependency between virtual table column order and mapping column sequence.
> The TEIID statement to create a virtual table goes like:
> CREATE VIEW TargetModelViewName (
> ColumnA … 1
> ColumnB … 2
> ColumnC …) … 3
> AS SELECT
> SourceModel.SourceTable.ColX AS ColumnA, 1
> SourceModel.SourceTable.ColY AS ColumnB, 2
> SourceModel.SourceTable.ColZ AS ColumnC; 3
> In any 4th+ generation query language a positional dependency is not expected, and therefore the following statement should also work, but fails in the TEIID
> CREATE VIEW TargetModelViewName (
> ColumnA … 1
> ColumnB … 2
> ColumnC …) … 3
> AS SELECT
> SourceModel.SourceTable.ColX AS ColumnA, 1
> SourceModel.SourceTable.ColZ AS ColumnC, 3
> SourceModel.SourceTable.ColY AS ColumnB; 2
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
10 years
[JBoss JIRA] (TEIID-4064) OData - missing non-nullable property
by Juraj Duráni (JIRA)
[ https://issues.jboss.org/browse/TEIID-4064?page=com.atlassian.jira.plugin... ]
Juraj Duráni commented on TEIID-4064:
-------------------------------------
[~rareddy] Neither result, nor query is wrong. Teiid executes query correctly. I think that problem is with building of the JSON/XML result.
I have updated the description.
> OData - missing non-nullable property
> -------------------------------------
>
> Key: TEIID-4064
> URL: https://issues.jboss.org/browse/TEIID-4064
> Project: Teiid
> Issue Type: Sub-task
> Components: OData
> Reporter: Juraj Duráni
> Assignee: Ramesh Reddy
>
> Change DDL for tables Customer and Orders in VDB as follows:
> {code:sql}
> CREATE FOREIGN TABLE Customers (
> id integer PRIMARY KEY OPTIONS (NAMEINSOURCE 'id'),
> name varchar(10)) OPTIONS (NAMEINSOURCE 'DB.PUBLIC.CUSTOMERS');
> CREATE FOREIGN TABLE Orders (
> id integer PRIMARY KEY OPTIONS (NAMEINSOURCE 'id'),
> customerid integer,
> place varchar(10),
> FOREIGN KEY (customerid) REFERENCES Customers(id)) OPTIONS (NAMEINSOURCE 'DB.PUBLIC.ORDERS');
> {code}
> Note, that both tables have same name of primary key named "id".
> Invoke GET method to URL http://localhost:8080/odata4/olingo_basic/Source/Customers/?$count=true&$...
> *Result:*
> {code:xml}
> <error>
> <code>400</code>
> <message>The non-nullable property 'id' is missing.</message>
> </error>
> {code}
> Here are selected part of Teiid's log:
> *Query:*
> {code:sql}
> SELECT g10.id, g10.name, g11.id, g11.customerid, g11.place FROM Source.Customers AS g10 LEFT OUTER JOIN Source.Orders AS g11 ON g10.id = g11.customerid ORDER BY g10.id
> {code}
> *Result:*
> |id|name|id|customerid|place|
> |1|customer1|1|1|town|
> |1|customer1|2|1|state|
> |1|customer1|3|1|country|
> |1|customer1|4|1|abroad|
> |2|customer2|5|2|state|
> |2|customer2|6|2|country|
> |3|customer3|7|3|town|
> |3|customer3|8|3|town|
> |4|customer4|<null>|<null>|<null>|
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
10 years
[JBoss JIRA] (TEIID-4064) OData - missing non-nullable property
by Juraj Duráni (JIRA)
[ https://issues.jboss.org/browse/TEIID-4064?page=com.atlassian.jira.plugin... ]
Juraj Duráni updated TEIID-4064:
--------------------------------
Description:
Change DDL for tables Customer and Orders in VDB as follows:
{code:sql}
CREATE FOREIGN TABLE Customers (
id integer PRIMARY KEY OPTIONS (NAMEINSOURCE 'id'),
name varchar(10)) OPTIONS (NAMEINSOURCE 'DB.PUBLIC.CUSTOMERS');
CREATE FOREIGN TABLE Orders (
id integer PRIMARY KEY OPTIONS (NAMEINSOURCE 'id'),
customerid integer,
place varchar(10),
FOREIGN KEY (customerid) REFERENCES Customers(id)) OPTIONS (NAMEINSOURCE 'DB.PUBLIC.ORDERS');
{code}
Note, that both tables have same name of primary key named "id".
Invoke GET method to URL http://localhost:8080/odata4/olingo_basic/Source/Customers/?$count=true&$...
*Result:*
{code:xml}
<error>
<code>400</code>
<message>The non-nullable property 'id' is missing.</message>
</error>
{code}
Here are selected part of Teiid's log:
*Query:*
{code:sql}
SELECT g10.id, g10.name, g11.id, g11.customerid, g11.place FROM Source.Customers AS g10 LEFT OUTER JOIN Source.Orders AS g11 ON g10.id = g11.customerid ORDER BY g10.id
{code}
*Result:*
|id|name|id|customerid|place|
|1|customer1|1|1|town|
|1|customer1|2|1|state|
|1|customer1|3|1|country|
|1|customer1|4|1|abroad|
|2|customer2|5|2|state|
|2|customer2|6|2|country|
|3|customer3|7|3|town|
|3|customer3|8|3|town|
|4|customer4|<null>|<null>|<null>|
was:
Change DDL for tables Customer and Orders in VDB as follows:
{code:sql}
CREATE FOREIGN TABLE Customers (
id integer PRIMARY KEY OPTIONS (NAMEINSOURCE 'id'),
name varchar(10)) OPTIONS (NAMEINSOURCE 'DB.PUBLIC.CUSTOMERS');
CREATE FOREIGN TABLE Orders (
id integer PRIMARY KEY OPTIONS (NAMEINSOURCE 'id'),
customerid integer,
place varchar(10),
FOREIGN KEY (customerid) REFERENCES Customers(id)) OPTIONS (NAMEINSOURCE 'DB.PUBLIC.ORDERS');
{code}
Note, that both tables have same name of primary key named "id".
Invoke GET method to URL http://localhost:8080/odata4/olingo_basic/Source/Customers/?$count=true&$...
*Result:* The non-nullable property 'id' is missing.
Here are selected part of Teiid's log:
*Query:*
{code:sql}
SELECT g10.id, g10.name, g11.id, g11.customerid, g11.place FROM Source.Customers AS g10 LEFT OUTER JOIN Source.Orders AS g11 ON g10.id = g11.customerid ORDER BY g10.id
{code}
*Result:*
|id|name|id|customerid|place|
|1|customer1|1|1|town|
|1|customer1|2|1|state|
|1|customer1|3|1|country|
|1|customer1|4|1|abroad|
|2|customer2|5|2|state|
|2|customer2|6|2|country|
|3|customer3|7|3|town|
|3|customer3|8|3|town|
|4|customer4|<null>|<null>|<null>|
> OData - missing non-nullable property
> -------------------------------------
>
> Key: TEIID-4064
> URL: https://issues.jboss.org/browse/TEIID-4064
> Project: Teiid
> Issue Type: Sub-task
> Components: OData
> Reporter: Juraj Duráni
> Assignee: Ramesh Reddy
>
> Change DDL for tables Customer and Orders in VDB as follows:
> {code:sql}
> CREATE FOREIGN TABLE Customers (
> id integer PRIMARY KEY OPTIONS (NAMEINSOURCE 'id'),
> name varchar(10)) OPTIONS (NAMEINSOURCE 'DB.PUBLIC.CUSTOMERS');
> CREATE FOREIGN TABLE Orders (
> id integer PRIMARY KEY OPTIONS (NAMEINSOURCE 'id'),
> customerid integer,
> place varchar(10),
> FOREIGN KEY (customerid) REFERENCES Customers(id)) OPTIONS (NAMEINSOURCE 'DB.PUBLIC.ORDERS');
> {code}
> Note, that both tables have same name of primary key named "id".
> Invoke GET method to URL http://localhost:8080/odata4/olingo_basic/Source/Customers/?$count=true&$...
> *Result:*
> {code:xml}
> <error>
> <code>400</code>
> <message>The non-nullable property 'id' is missing.</message>
> </error>
> {code}
> Here are selected part of Teiid's log:
> *Query:*
> {code:sql}
> SELECT g10.id, g10.name, g11.id, g11.customerid, g11.place FROM Source.Customers AS g10 LEFT OUTER JOIN Source.Orders AS g11 ON g10.id = g11.customerid ORDER BY g10.id
> {code}
> *Result:*
> |id|name|id|customerid|place|
> |1|customer1|1|1|town|
> |1|customer1|2|1|state|
> |1|customer1|3|1|country|
> |1|customer1|4|1|abroad|
> |2|customer2|5|2|state|
> |2|customer2|6|2|country|
> |3|customer3|7|3|town|
> |3|customer3|8|3|town|
> |4|customer4|<null>|<null>|<null>|
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
10 years