[
https://issues.apache.org/jira/browse/OPENJPA-2147?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13217889#comment-13217889
]
Dmitry Pavlov edited comment on OPENJPA-2147 at 2/28/12 4:51 AM:
-----------------------------------------------------------------
The issue OPENJPA-2144 shares the same unit test.
Please, see TestRecursiveRelationshipsWithIdClass.testPreparedSQLQueryToTree()
to reproduce the issue.
Please note, the test can reproduce the problem only after fixing OPENJPA-2144
(patch is available).
was (Author: dmitry.pavlov):
The issue OPENJPA-2144 shares the same unit test.
Please, see TestRecursiveRelationshipsWithIdClass.testPreparedSQLQueryToTree()
to reproduce the issue.
> Inability to use Prepared SQL Query Cache and 'Identity Class' @IdClass
> -----------------------------------------------------------------------
>
> Key: OPENJPA-2147
> URL: https://issues.apache.org/jira/browse/OPENJPA-2147
> Project: OpenJPA
> Issue Type: Bug
> Components: jdbc
> Affects Versions: 2.0.0, 2.0.1, 2.1.0, 2.1.1, 2.2.0
> Reporter: Dmitry Pavlov
>
> There is an entity Node2 which is using an identity class.
> It is introduced in an unit test attached to related issue OPENJPA-2144.
> I have made two sequential queries to Node2 at the same transaction, but
> different query objects in order to use prepared SQL query Cache.
> JPQL: SELECT p FROM Node2 p WHERE p.parent = :parent
> Not cached query works fine and returns not empty list:
> 302884 test TRACE [main] openjpa.Runtime - Query "SELECT p FROM Node2 p
> WHERE p.parent = :parent" is cached."
> 302884 test TRACE [main] openjpa.Query - Executing query: [SELECT p FROM
> Node2 p WHERE p.parent = :parent] with parameters: {parent=1351::1::2}
> 302962 test TRACE [main] openjpa.jdbc.SQL - <t 5142872, conn 30621423>
> executing prepstmnt 21961831 SELECT t0.district, t0.id, t0.region,
> t0.version, t0.data, t0.PARENT_ID FROM NODE2 t0 WHERE (t0.PARENT_ID = ? AND
> t0.region = ? AND t0.district = ?) [params=(long) 1351, (int) 1, (int) 2]
> Sequential cached query returns empty list:
> 346242 test TRACE [main] openjpa.Query - Executing query: [SELECT p FROM
> Node2 p WHERE p.parent = :parent] with parameters: {0=1, 1=1, 2=2}
> 346242 test TRACE [main] openjpa.jdbc.SQL - <t 5142872, conn 30621423>
> executing prepstmnt 13122813 SELECT t0.district, t0.id, t0.region,
> t0.version, t0.data, t0.PARENT_ID FROM NODE2 t0 WHERE (t0.PARENT_ID = ? AND
> t0.region = ? AND t0.district = ?) [params=(int) 1, (int) 1, (int) 2]
> You can see that wrong paraments were passed into the cached generated raw
> SQL in the second query!
> That is the problem, we have wrong query result.
--
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