[teiid-issues] [JBoss JIRA] (TEIID-4603) Insert issue when cache contains multiple pojo's with the same key value

Van Halbert (JIRA) issues at jboss.org
Mon Nov 28 08:08:00 EST 2016


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

Van Halbert commented on TEIID-4603:
------------------------------------

 I have two POJOs, two resource-adapters configured, single JDG instance and cache is used.
Tested usecase:

{code}
INSERT INTO jdgSource1.SmallA(intKey,stringKey,booleanValue) VALUES(1,'1',true);
SELECT * FROM jdgSource1.SmallA;
INSERT INTO jdgSource2.CustomerReport(customerId,totalAmount) VALUES(1,1);
SELECT * FROM jdgSource2.CustomerReport;
SELECT * FROM jdgSource1.SmallA;
{code}

Everything works as expected but the last query. It returns empty resultset, but there should be single row. (Second query returned correctly 1 row)
The issue seems to be that last INSERT somehow erases the previous contents.
When you try:

{code}
INSERT INTO jdgSource1.SmallA(intKey,stringKey,booleanValue) VALUES(1,'1',true);
INSERT INTO jdgSource2.CustomerReport(customerId,totalAmount) VALUES(1,1);
INSERT INTO jdgSource1.SmallA(intKey,stringKey,booleanValue) VALUES(2,'2',false);
SELECT * FROM jdgSource1.SmallA;
{code}

you get only one row by the fourth query.

The reason is:
You have two POJOs, both have an id specified (different column names). When there is common Id value for different POJOs, in previous example it is value 1 for both 'intKey' and 'customerId', the object in jdg cache get overwritten. It is due to the fact, that objects in JDG are being stored in key-value way.
This is undesirable behaviour, because an object of one POJO class is overwritten by an object of different POJO class. This is blocking issue.

Note: if the id is unique across all POJOs inserted into single cache, this problem doesn't occur:

{code}
INSERT INTO jdgSource1.SmallA(intKey,stringKey,booleanValue) VALUES(1,'1',true);
INSERT INTO jdgSource2.CustomerReport(customerId,totalAmount) VALUES(3,3);
INSERT INTO jdgSource1.SmallA(intKey,stringKey,booleanValue) VALUES(2,'2',false);
SELECT * FROM jdgSource1.SmallA;
{code}
in this case, correct values are being returned.


> Insert issue when cache contains multiple pojo's with the same key value
> ------------------------------------------------------------------------
>
>                 Key: TEIID-4603
>                 URL: https://issues.jboss.org/browse/TEIID-4603
>             Project: Teiid
>          Issue Type: Bug
>          Components: Misc. Connectors
>    Affects Versions: 9.2
>            Reporter: Van Halbert
>            Assignee: Van Halbert
>            Priority: Blocker
>             Fix For: 9.2, 8.12.8.6_3
>
>
> There is an INSERT issue when there are multiple pojo's stored in the same cache and the keys' overlap (meaning the different types of pojo's have the same key).  



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the teiid-issues mailing list