From dev-return-14187-apmail-openjpa-dev-archive=openjpa.apache.org@openjpa.apache.org Wed Nov 11 17:54:03 2009 Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 65666 invoked from network); 11 Nov 2009 17:54:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 11 Nov 2009 17:54:03 -0000 Received: (qmail 35550 invoked by uid 500); 11 Nov 2009 17:54:03 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 35481 invoked by uid 500); 11 Nov 2009 17:54:03 -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 35470 invoked by uid 99); 11 Nov 2009 17:54:03 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Nov 2009 17:54:03 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Nov 2009 17:54:00 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 8F2F5234C1EF for ; Wed, 11 Nov 2009 09:53:39 -0800 (PST) Message-ID: <477288798.1257962019571.JavaMail.jira@brutus> Date: Wed, 11 Nov 2009 17:53:39 +0000 (UTC) From: "Albert Lee (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Commented: (OPENJPA-1381) IllegalStateException on query method call after named query is created twice. In-Reply-To: <2052108387.1257954939572.JavaMail.jira@brutus> 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-1381?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12776536#action_12776536 ] Albert Lee commented on OPENJPA-1381: ------------------------------------- Work around of this limitation is to specify query hint "openjpa.hint.IgnorePreparedQuery" to true. What is the reason cached query is treated as SQL and subsequently does not allow query methods that requires JPQL/Criteria API as the source language? > IllegalStateException on query method call after named query is created twice. > ------------------------------------------------------------------------------ > > Key: OPENJPA-1381 > URL: https://issues.apache.org/jira/browse/OPENJPA-1381 > Project: OpenJPA > Issue Type: Bug > Components: kernel > Affects Versions: 2.0.0 > Reporter: Albert Lee > Assignee: Albert Lee > Fix For: 2.0.0 > > > When a query method is called (e.g. setLockMode) on a named query that has been created twice, an IllegalStateException is thrown: > Query q1 = em.createNamedQuery("xxxx"); > ,,,, > Query q2 = em.createNamedQuery("xxxx"); > q2.setLockMode(READ); > 11078 test TRACE [Thread-4] Tests - Caught exception and continue: java.lang.IllegalStateException: Query is neither a JPQL SELECT nor a Criteria API query. > 11078 test TRACE [Thread-4] DumpStack - java.lang.IllegalStateException: Query is neither a JPQL SELECT nor a Criteria API query. > at org.apache.openjpa.persistence.QueryImpl.assertJPQLOrCriteriaQuery(QueryImpl.java:377) > at org.apache.openjpa.persistence.QueryImpl.setLockMode(QueryImpl.java:396) > at org.apache.openjpa.persistence.QueryImpl.setLockMode(QueryImpl.java:1) > at org.apache.openjpa.persistence.lockmgr.SequencedActionsTest.launchCommonSequence(SequencedActionsTest.java:409) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.