Return-Path: X-Original-To: apmail-openjpa-dev-archive@www.apache.org Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8944B959C for ; Tue, 28 Feb 2012 04:53:14 +0000 (UTC) Received: (qmail 79501 invoked by uid 500); 28 Feb 2012 04:53:13 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 79433 invoked by uid 500); 28 Feb 2012 04:53:11 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 79393 invoked by uid 99); 28 Feb 2012 04:53:10 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Feb 2012 04:53:10 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Feb 2012 04:53:08 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id C4A1233EF65 for ; Tue, 28 Feb 2012 04:52:48 +0000 (UTC) Date: Tue, 28 Feb 2012 04:52:48 +0000 (UTC) From: "Dmitry Pavlov (Issue Comment Edited) (JIRA)" To: dev@openjpa.apache.org Message-ID: <162156109.26578.1330404768807.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <302978481.26539.1330403628908.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Issue Comment Edited] (OPENJPA-2147) Inability to use Prepared SQL Query Cache and 'Identity Class' @IdClass MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ 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 - 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 - 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