You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Michael Glauche (JIRA)" <ji...@apache.org> on 2012/07/10 20:50:34 UTC

[jira] [Created] (OPENJPA-2228) QuerySQLCache broken for Entities with @EmbeddedId

Michael Glauche created OPENJPA-2228:
----------------------------------------

             Summary: QuerySQLCache broken for Entities with @EmbeddedId
                 Key: OPENJPA-2228
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2228
             Project: OpenJPA
          Issue Type: Bug
          Components: query
    Affects Versions: 2.2.0
            Reporter: Michael Glauche


Multiple calls of a query which has some Relationships with @EmbeddedId fields fails if QuerySQLCache is enabled.

q = em.createQuery("select l from ListTest l where l.te=:test");
does create:
SELECT t0.id, t0.keyA, t0.keyB, t0.keyC, t1.keyA, t1.keyB, t1.keyC, t1.data1, 
        t1.data2 
    FROM ListTest t0 LEFT OUTER JOIN TestEntity t1 ON t0.keyA = t1.keyA AND t0.keyB 
        = t1.keyB AND t0.keyC = t1.keyC 
    WHERE (t0.keyA = ? AND t0.keyB = ? AND t0.keyC = ?) 
[params=(int) 1, (int) 2, (int) 3]

however a second query will create:
q = em.createQuery("select l from ListTest l where l.te=:test");
SELECT t0.id, t0.keyA, t0.keyB, t0.keyC, t1.keyA, t1.keyB, t1.keyC, t1.data1, 
        t1.data2 
    FROM ListTest t0 LEFT OUTER JOIN TestEntity t1 ON t0.keyA = t1.keyA AND t0.keyB 
        = t1.keyB AND t0.keyC = t1.keyC 
    WHERE (t0.keyA = ? AND t0.keyB = ? AND t0.keyC = ?) 
[params=(int) 3, (int) 2, (int) 3]

Note the wrong first param !
(There is some Index filed calculated somewhere in the query and the index Array has [0,0,0] as values, so the 0th position does get updated three times .. the bug should be something with the index i think)

See attached test-project


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (OPENJPA-2228) QuerySQLCache broken for Entities with @EmbeddedId

Posted by "Michael Glauche (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Glauche updated OPENJPA-2228:
-------------------------------------

    Attachment: openjpaBugreport.zip

Small demo for bug, see failing maven test, it works if QuerySqlCache is disabled
                
> QuerySQLCache broken for Entities with @EmbeddedId
> --------------------------------------------------
>
>                 Key: OPENJPA-2228
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2228
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 2.2.0
>            Reporter: Michael Glauche
>         Attachments: openjpaBugreport.zip
>
>
> Multiple calls of a query which has some Relationships with @EmbeddedId fields fails if QuerySQLCache is enabled.
> q = em.createQuery("select l from ListTest l where l.te=:test");
> does create:
> SELECT t0.id, t0.keyA, t0.keyB, t0.keyC, t1.keyA, t1.keyB, t1.keyC, t1.data1, 
>         t1.data2 
>     FROM ListTest t0 LEFT OUTER JOIN TestEntity t1 ON t0.keyA = t1.keyA AND t0.keyB 
>         = t1.keyB AND t0.keyC = t1.keyC 
>     WHERE (t0.keyA = ? AND t0.keyB = ? AND t0.keyC = ?) 
> [params=(int) 1, (int) 2, (int) 3]
> however a second query will create:
> q = em.createQuery("select l from ListTest l where l.te=:test");
> SELECT t0.id, t0.keyA, t0.keyB, t0.keyC, t1.keyA, t1.keyB, t1.keyC, t1.data1, 
>         t1.data2 
>     FROM ListTest t0 LEFT OUTER JOIN TestEntity t1 ON t0.keyA = t1.keyA AND t0.keyB 
>         = t1.keyB AND t0.keyC = t1.keyC 
>     WHERE (t0.keyA = ? AND t0.keyB = ? AND t0.keyC = ?) 
> [params=(int) 3, (int) 2, (int) 3]
> Note the wrong first param !
> (There is some Index filed calculated somewhere in the query and the index Array has [0,0,0] as values, so the 0th position does get updated three times .. the bug should be something with the index i think)
> See attached test-project

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (OPENJPA-2228) QuerySQLCache broken for Entities with @EmbeddedId

Posted by "Helen Xu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Helen Xu reassigned OPENJPA-2228:
---------------------------------

    Assignee: Helen Xu
    
> QuerySQLCache broken for Entities with @EmbeddedId
> --------------------------------------------------
>
>                 Key: OPENJPA-2228
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2228
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 2.2.0
>            Reporter: Michael Glauche
>            Assignee: Helen Xu
>         Attachments: openjpaBugreport.zip
>
>
> Multiple calls of a query which has some Relationships with @EmbeddedId fields fails if QuerySQLCache is enabled.
> q = em.createQuery("select l from ListTest l where l.te=:test");
> does create:
> SELECT t0.id, t0.keyA, t0.keyB, t0.keyC, t1.keyA, t1.keyB, t1.keyC, t1.data1, 
>         t1.data2 
>     FROM ListTest t0 LEFT OUTER JOIN TestEntity t1 ON t0.keyA = t1.keyA AND t0.keyB 
>         = t1.keyB AND t0.keyC = t1.keyC 
>     WHERE (t0.keyA = ? AND t0.keyB = ? AND t0.keyC = ?) 
> [params=(int) 1, (int) 2, (int) 3]
> however a second query will create:
> q = em.createQuery("select l from ListTest l where l.te=:test");
> SELECT t0.id, t0.keyA, t0.keyB, t0.keyC, t1.keyA, t1.keyB, t1.keyC, t1.data1, 
>         t1.data2 
>     FROM ListTest t0 LEFT OUTER JOIN TestEntity t1 ON t0.keyA = t1.keyA AND t0.keyB 
>         = t1.keyB AND t0.keyC = t1.keyC 
>     WHERE (t0.keyA = ? AND t0.keyB = ? AND t0.keyC = ?) 
> [params=(int) 3, (int) 2, (int) 3]
> Note the wrong first param !
> (There is some Index filed calculated somewhere in the query and the index Array has [0,0,0] as values, so the 0th position does get updated three times .. the bug should be something with the index i think)
> See attached test-project

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (OPENJPA-2228) QuerySQLCache broken for Entities with @EmbeddedId

Posted by "Helen Xu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Helen Xu updated OPENJPA-2228:
------------------------------

    Attachment: OPENJPA-2228.patch

Sorry, I didn't include the actual fix which is in openjpa-jdbc.

new patch attached.
                
> QuerySQLCache broken for Entities with @EmbeddedId
> --------------------------------------------------
>
>                 Key: OPENJPA-2228
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2228
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 2.2.0
>            Reporter: Michael Glauche
>            Assignee: Helen Xu
>         Attachments: OPENJPA-2228.patch, openjpaBugreport.zip
>
>
> Multiple calls of a query which has some Relationships with @EmbeddedId fields fails if QuerySQLCache is enabled.
> q = em.createQuery("select l from ListTest l where l.te=:test");
> does create:
> SELECT t0.id, t0.keyA, t0.keyB, t0.keyC, t1.keyA, t1.keyB, t1.keyC, t1.data1, 
>         t1.data2 
>     FROM ListTest t0 LEFT OUTER JOIN TestEntity t1 ON t0.keyA = t1.keyA AND t0.keyB 
>         = t1.keyB AND t0.keyC = t1.keyC 
>     WHERE (t0.keyA = ? AND t0.keyB = ? AND t0.keyC = ?) 
> [params=(int) 1, (int) 2, (int) 3]
> however a second query will create:
> q = em.createQuery("select l from ListTest l where l.te=:test");
> SELECT t0.id, t0.keyA, t0.keyB, t0.keyC, t1.keyA, t1.keyB, t1.keyC, t1.data1, 
>         t1.data2 
>     FROM ListTest t0 LEFT OUTER JOIN TestEntity t1 ON t0.keyA = t1.keyA AND t0.keyB 
>         = t1.keyB AND t0.keyC = t1.keyC 
>     WHERE (t0.keyA = ? AND t0.keyB = ? AND t0.keyC = ?) 
> [params=(int) 3, (int) 2, (int) 3]
> Note the wrong first param !
> (There is some Index filed calculated somewhere in the query and the index Array has [0,0,0] as values, so the 0th position does get updated three times .. the bug should be something with the index i think)
> See attached test-project

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (OPENJPA-2228) QuerySQLCache broken for Entities with @EmbeddedId

Posted by "Helen Xu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Helen Xu updated OPENJPA-2228:
------------------------------

    Attachment:     (was: OPENJPA-2228.patch)
    
> QuerySQLCache broken for Entities with @EmbeddedId
> --------------------------------------------------
>
>                 Key: OPENJPA-2228
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2228
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 2.2.0
>            Reporter: Michael Glauche
>            Assignee: Helen Xu
>         Attachments: openjpaBugreport.zip
>
>
> Multiple calls of a query which has some Relationships with @EmbeddedId fields fails if QuerySQLCache is enabled.
> q = em.createQuery("select l from ListTest l where l.te=:test");
> does create:
> SELECT t0.id, t0.keyA, t0.keyB, t0.keyC, t1.keyA, t1.keyB, t1.keyC, t1.data1, 
>         t1.data2 
>     FROM ListTest t0 LEFT OUTER JOIN TestEntity t1 ON t0.keyA = t1.keyA AND t0.keyB 
>         = t1.keyB AND t0.keyC = t1.keyC 
>     WHERE (t0.keyA = ? AND t0.keyB = ? AND t0.keyC = ?) 
> [params=(int) 1, (int) 2, (int) 3]
> however a second query will create:
> q = em.createQuery("select l from ListTest l where l.te=:test");
> SELECT t0.id, t0.keyA, t0.keyB, t0.keyC, t1.keyA, t1.keyB, t1.keyC, t1.data1, 
>         t1.data2 
>     FROM ListTest t0 LEFT OUTER JOIN TestEntity t1 ON t0.keyA = t1.keyA AND t0.keyB 
>         = t1.keyB AND t0.keyC = t1.keyC 
>     WHERE (t0.keyA = ? AND t0.keyB = ? AND t0.keyC = ?) 
> [params=(int) 3, (int) 2, (int) 3]
> Note the wrong first param !
> (There is some Index filed calculated somewhere in the query and the index Array has [0,0,0] as values, so the 0th position does get updated three times .. the bug should be something with the index i think)
> See attached test-project

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2228) QuerySQLCache broken for Entities with @EmbeddedId

Posted by "Rick Curtis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13414447#comment-13414447 ] 

Rick Curtis commented on OPENJPA-2228:
--------------------------------------

Helen - It looks like you missed something when you created the patch.... it only has a testcase. 
                
> QuerySQLCache broken for Entities with @EmbeddedId
> --------------------------------------------------
>
>                 Key: OPENJPA-2228
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2228
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 2.2.0
>            Reporter: Michael Glauche
>            Assignee: Helen Xu
>         Attachments: OPENJPA-2228.patch, openjpaBugreport.zip
>
>
> Multiple calls of a query which has some Relationships with @EmbeddedId fields fails if QuerySQLCache is enabled.
> q = em.createQuery("select l from ListTest l where l.te=:test");
> does create:
> SELECT t0.id, t0.keyA, t0.keyB, t0.keyC, t1.keyA, t1.keyB, t1.keyC, t1.data1, 
>         t1.data2 
>     FROM ListTest t0 LEFT OUTER JOIN TestEntity t1 ON t0.keyA = t1.keyA AND t0.keyB 
>         = t1.keyB AND t0.keyC = t1.keyC 
>     WHERE (t0.keyA = ? AND t0.keyB = ? AND t0.keyC = ?) 
> [params=(int) 1, (int) 2, (int) 3]
> however a second query will create:
> q = em.createQuery("select l from ListTest l where l.te=:test");
> SELECT t0.id, t0.keyA, t0.keyB, t0.keyC, t1.keyA, t1.keyB, t1.keyC, t1.data1, 
>         t1.data2 
>     FROM ListTest t0 LEFT OUTER JOIN TestEntity t1 ON t0.keyA = t1.keyA AND t0.keyB 
>         = t1.keyB AND t0.keyC = t1.keyC 
>     WHERE (t0.keyA = ? AND t0.keyB = ? AND t0.keyC = ?) 
> [params=(int) 3, (int) 2, (int) 3]
> Note the wrong first param !
> (There is some Index filed calculated somewhere in the query and the index Array has [0,0,0] as values, so the 0th position does get updated three times .. the bug should be something with the index i think)
> See attached test-project

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (OPENJPA-2228) QuerySQLCache broken for Entities with @EmbeddedId

Posted by "Helen Xu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Helen Xu updated OPENJPA-2228:
------------------------------

    Attachment: OPENJPA-2228.patch

I was able to reproduce the problem. 

user parameter index got messed up when there are duplicate param key.

the fix and unit test attached.
                
> QuerySQLCache broken for Entities with @EmbeddedId
> --------------------------------------------------
>
>                 Key: OPENJPA-2228
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2228
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 2.2.0
>            Reporter: Michael Glauche
>            Assignee: Helen Xu
>         Attachments: OPENJPA-2228.patch, openjpaBugreport.zip
>
>
> Multiple calls of a query which has some Relationships with @EmbeddedId fields fails if QuerySQLCache is enabled.
> q = em.createQuery("select l from ListTest l where l.te=:test");
> does create:
> SELECT t0.id, t0.keyA, t0.keyB, t0.keyC, t1.keyA, t1.keyB, t1.keyC, t1.data1, 
>         t1.data2 
>     FROM ListTest t0 LEFT OUTER JOIN TestEntity t1 ON t0.keyA = t1.keyA AND t0.keyB 
>         = t1.keyB AND t0.keyC = t1.keyC 
>     WHERE (t0.keyA = ? AND t0.keyB = ? AND t0.keyC = ?) 
> [params=(int) 1, (int) 2, (int) 3]
> however a second query will create:
> q = em.createQuery("select l from ListTest l where l.te=:test");
> SELECT t0.id, t0.keyA, t0.keyB, t0.keyC, t1.keyA, t1.keyB, t1.keyC, t1.data1, 
>         t1.data2 
>     FROM ListTest t0 LEFT OUTER JOIN TestEntity t1 ON t0.keyA = t1.keyA AND t0.keyB 
>         = t1.keyB AND t0.keyC = t1.keyC 
>     WHERE (t0.keyA = ? AND t0.keyB = ? AND t0.keyC = ?) 
> [params=(int) 3, (int) 2, (int) 3]
> Note the wrong first param !
> (There is some Index filed calculated somewhere in the query and the index Array has [0,0,0] as values, so the 0th position does get updated three times .. the bug should be something with the index i think)
> See attached test-project

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2228) QuerySQLCache broken for Entities with @EmbeddedId

Posted by "Rick Curtis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13416647#comment-13416647 ] 

Rick Curtis commented on OPENJPA-2228:
--------------------------------------

Committed revision 1362679 to trunk. Thanks for the patch Helen!
                
> QuerySQLCache broken for Entities with @EmbeddedId
> --------------------------------------------------
>
>                 Key: OPENJPA-2228
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2228
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 2.2.0, 2.3.0
>            Reporter: Michael Glauche
>            Assignee: Helen Xu
>             Fix For: 2.3.0
>
>         Attachments: OPENJPA-2228.patch, openjpaBugreport.zip
>
>
> Multiple calls of a query which has some Relationships with @EmbeddedId fields fails if QuerySQLCache is enabled.
> q = em.createQuery("select l from ListTest l where l.te=:test");
> does create:
> SELECT t0.id, t0.keyA, t0.keyB, t0.keyC, t1.keyA, t1.keyB, t1.keyC, t1.data1, 
>         t1.data2 
>     FROM ListTest t0 LEFT OUTER JOIN TestEntity t1 ON t0.keyA = t1.keyA AND t0.keyB 
>         = t1.keyB AND t0.keyC = t1.keyC 
>     WHERE (t0.keyA = ? AND t0.keyB = ? AND t0.keyC = ?) 
> [params=(int) 1, (int) 2, (int) 3]
> however a second query will create:
> q = em.createQuery("select l from ListTest l where l.te=:test");
> SELECT t0.id, t0.keyA, t0.keyB, t0.keyC, t1.keyA, t1.keyB, t1.keyC, t1.data1, 
>         t1.data2 
>     FROM ListTest t0 LEFT OUTER JOIN TestEntity t1 ON t0.keyA = t1.keyA AND t0.keyB 
>         = t1.keyB AND t0.keyC = t1.keyC 
>     WHERE (t0.keyA = ? AND t0.keyB = ? AND t0.keyC = ?) 
> [params=(int) 3, (int) 2, (int) 3]
> Note the wrong first param !
> (There is some Index filed calculated somewhere in the query and the index Array has [0,0,0] as values, so the 0th position does get updated three times .. the bug should be something with the index i think)
> See attached test-project

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (OPENJPA-2228) QuerySQLCache broken for Entities with @EmbeddedId

Posted by "Albert Lee (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Albert Lee updated OPENJPA-2228:
--------------------------------

    Patch Info: Patch Available
    
> QuerySQLCache broken for Entities with @EmbeddedId
> --------------------------------------------------
>
>                 Key: OPENJPA-2228
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2228
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 2.2.0, 2.3.0
>            Reporter: Michael Glauche
>            Assignee: Helen Xu
>             Fix For: 2.3.0
>
>         Attachments: OPENJPA-2228.patch, openjpaBugreport.zip
>
>
> Multiple calls of a query which has some Relationships with @EmbeddedId fields fails if QuerySQLCache is enabled.
> q = em.createQuery("select l from ListTest l where l.te=:test");
> does create:
> SELECT t0.id, t0.keyA, t0.keyB, t0.keyC, t1.keyA, t1.keyB, t1.keyC, t1.data1, 
>         t1.data2 
>     FROM ListTest t0 LEFT OUTER JOIN TestEntity t1 ON t0.keyA = t1.keyA AND t0.keyB 
>         = t1.keyB AND t0.keyC = t1.keyC 
>     WHERE (t0.keyA = ? AND t0.keyB = ? AND t0.keyC = ?) 
> [params=(int) 1, (int) 2, (int) 3]
> however a second query will create:
> q = em.createQuery("select l from ListTest l where l.te=:test");
> SELECT t0.id, t0.keyA, t0.keyB, t0.keyC, t1.keyA, t1.keyB, t1.keyC, t1.data1, 
>         t1.data2 
>     FROM ListTest t0 LEFT OUTER JOIN TestEntity t1 ON t0.keyA = t1.keyA AND t0.keyB 
>         = t1.keyB AND t0.keyC = t1.keyC 
>     WHERE (t0.keyA = ? AND t0.keyB = ? AND t0.keyC = ?) 
> [params=(int) 3, (int) 2, (int) 3]
> Note the wrong first param !
> (There is some Index filed calculated somewhere in the query and the index Array has [0,0,0] as values, so the 0th position does get updated three times .. the bug should be something with the index i think)
> See attached test-project

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (OPENJPA-2228) QuerySQLCache broken for Entities with @EmbeddedId

Posted by "Rick Curtis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rick Curtis updated OPENJPA-2228:
---------------------------------

    Affects Version/s: 2.3.0
        Fix Version/s: 2.3.0
    
> QuerySQLCache broken for Entities with @EmbeddedId
> --------------------------------------------------
>
>                 Key: OPENJPA-2228
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2228
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 2.2.0, 2.3.0
>            Reporter: Michael Glauche
>            Assignee: Helen Xu
>             Fix For: 2.3.0
>
>         Attachments: OPENJPA-2228.patch, openjpaBugreport.zip
>
>
> Multiple calls of a query which has some Relationships with @EmbeddedId fields fails if QuerySQLCache is enabled.
> q = em.createQuery("select l from ListTest l where l.te=:test");
> does create:
> SELECT t0.id, t0.keyA, t0.keyB, t0.keyC, t1.keyA, t1.keyB, t1.keyC, t1.data1, 
>         t1.data2 
>     FROM ListTest t0 LEFT OUTER JOIN TestEntity t1 ON t0.keyA = t1.keyA AND t0.keyB 
>         = t1.keyB AND t0.keyC = t1.keyC 
>     WHERE (t0.keyA = ? AND t0.keyB = ? AND t0.keyC = ?) 
> [params=(int) 1, (int) 2, (int) 3]
> however a second query will create:
> q = em.createQuery("select l from ListTest l where l.te=:test");
> SELECT t0.id, t0.keyA, t0.keyB, t0.keyC, t1.keyA, t1.keyB, t1.keyC, t1.data1, 
>         t1.data2 
>     FROM ListTest t0 LEFT OUTER JOIN TestEntity t1 ON t0.keyA = t1.keyA AND t0.keyB 
>         = t1.keyB AND t0.keyC = t1.keyC 
>     WHERE (t0.keyA = ? AND t0.keyB = ? AND t0.keyC = ?) 
> [params=(int) 3, (int) 2, (int) 3]
> Note the wrong first param !
> (There is some Index filed calculated somewhere in the query and the index Array has [0,0,0] as values, so the 0th position does get updated three times .. the bug should be something with the index i think)
> See attached test-project

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (OPENJPA-2228) QuerySQLCache broken for Entities with @EmbeddedId

Posted by "Rick Curtis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rick Curtis resolved OPENJPA-2228.
----------------------------------

    Resolution: Fixed
    
> QuerySQLCache broken for Entities with @EmbeddedId
> --------------------------------------------------
>
>                 Key: OPENJPA-2228
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2228
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 2.2.0, 2.3.0
>            Reporter: Michael Glauche
>            Assignee: Helen Xu
>             Fix For: 2.3.0
>
>         Attachments: OPENJPA-2228.patch, openjpaBugreport.zip
>
>
> Multiple calls of a query which has some Relationships with @EmbeddedId fields fails if QuerySQLCache is enabled.
> q = em.createQuery("select l from ListTest l where l.te=:test");
> does create:
> SELECT t0.id, t0.keyA, t0.keyB, t0.keyC, t1.keyA, t1.keyB, t1.keyC, t1.data1, 
>         t1.data2 
>     FROM ListTest t0 LEFT OUTER JOIN TestEntity t1 ON t0.keyA = t1.keyA AND t0.keyB 
>         = t1.keyB AND t0.keyC = t1.keyC 
>     WHERE (t0.keyA = ? AND t0.keyB = ? AND t0.keyC = ?) 
> [params=(int) 1, (int) 2, (int) 3]
> however a second query will create:
> q = em.createQuery("select l from ListTest l where l.te=:test");
> SELECT t0.id, t0.keyA, t0.keyB, t0.keyC, t1.keyA, t1.keyB, t1.keyC, t1.data1, 
>         t1.data2 
>     FROM ListTest t0 LEFT OUTER JOIN TestEntity t1 ON t0.keyA = t1.keyA AND t0.keyB 
>         = t1.keyB AND t0.keyC = t1.keyC 
>     WHERE (t0.keyA = ? AND t0.keyB = ? AND t0.keyC = ?) 
> [params=(int) 3, (int) 2, (int) 3]
> Note the wrong first param !
> (There is some Index filed calculated somewhere in the query and the index Array has [0,0,0] as values, so the 0th position does get updated three times .. the bug should be something with the index i think)
> See attached test-project

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira