Return-Path: Delivered-To: apmail-incubator-open-jpa-dev-archive@locus.apache.org Received: (qmail 47775 invoked from network); 24 Apr 2007 22:07:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 Apr 2007 22:07:50 -0000 Received: (qmail 97139 invoked by uid 500); 24 Apr 2007 22:07:56 -0000 Delivered-To: apmail-incubator-open-jpa-dev-archive@incubator.apache.org Received: (qmail 97114 invoked by uid 500); 24 Apr 2007 22:07:56 -0000 Mailing-List: contact open-jpa-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: open-jpa-dev@incubator.apache.org Delivered-To: mailing list open-jpa-dev@incubator.apache.org Received: (qmail 97105 invoked by uid 99); 24 Apr 2007 22:07:56 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Apr 2007 15:07:56 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of mprudhomapache@gmail.com designates 64.233.166.176 as permitted sender) Received: from [64.233.166.176] (HELO py-out-1112.google.com) (64.233.166.176) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Apr 2007 15:07:49 -0700 Received: by py-out-1112.google.com with SMTP id p76so1794543pyb for ; Tue, 24 Apr 2007 15:07:28 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:mime-version:in-reply-to:references:content-type:message-id:content-transfer-encoding:from:subject:date:to:x-mailer:sender; b=TWbM5W2rFA8IhkTK3Zd/fa3J3XlJ+c/S1Q275sS2HKH+XgGpsO/WznDYYFpAFwaL+GJEDNp3pHpYoKm0y5jTbsacCgIgenN3AgvnrW1eYybfqHew+btD6d7kwQX6KmK7Duo1R0NINV3PvBSQdYSn0IzIj9vTljTePxxb8OG49e0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:mime-version:in-reply-to:references:content-type:message-id:content-transfer-encoding:from:subject:date:to:x-mailer:sender; b=JLw65JfXzSmmufggPWXapM9D8dbYOsAm7RSVBXYHLSxDQxLDNczIDMcG2wY63Iezm/Px8rYNpkeuvna/cRDqut3k7lzx5kJ/UP4QHT3yWocJF1Qy9S6FBU777E6IPZCl1bIlDMY3Zxjy65IBwhuet/ZZYnnmI7mH/LQUFRnmshM= Received: by 10.35.75.1 with SMTP id c1mr13798596pyl.1177452448581; Tue, 24 Apr 2007 15:07:28 -0700 (PDT) Received: from ?192.168.15.100? ( [66.248.222.34]) by mx.google.com with ESMTP id n29sm15948672pyh.2007.04.24.15.07.27; Tue, 24 Apr 2007 15:07:28 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v752.3) In-Reply-To: References: Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Marc Prud'hommeaux Subject: Re: Set query params without TX? Date: Tue, 24 Apr 2007 15:07:15 -0700 To: open-jpa-dev@incubator.apache.org X-Mailer: Apple Mail (2.752.3) Sender: Marc Prud'hommeaux X-Virus-Checked: Checked by ClamAV on apache.org Dain- Can you send the embedded exception as well? That should tell us who closed the query, and it might give us a hint why... On Apr 24, 2007, at 3:03 PM, Dain Sundstrom wrote: > I have some code that runs outside of a transaction which does > basically the following: > > Query query = entityManager.createNamedQuery(name) > query.setParameter(1, "foo"); > List results = query.getResultList(); > > If I don't set the parameter the code works fine (assuming the > query didn't need a parameter), but when I set the parameter, I get > the following exception: > > Caused by: <0.9.7-incubating-SNAPSHOT fatal user error> > org.apache.openjpa.persistence.InvalidStateException: The context > has been closed. The stack trace at which the context was closed > is held in the embedded exception. > FailedObject: java.lang.IllegalStateException > at org.apache.openjpa.kernel.BrokerImpl.assertOpen(BrokerImpl.java: > 4283) > at org.apache.openjpa.kernel.QueryImpl.assertOpen(QueryImpl.java: > 1613) > at org.apache.openjpa.kernel.DelegatingQuery.assertOpen > (DelegatingQuery.java:626) > at org.apache.openjpa.persistence.QueryImpl.setParameter > (QueryImpl.java:404) > at org.apache.openjpa.persistence.QueryImpl.setParameter > (QueryImpl.java:49) > at org.apache.openejb.core.cmp.jpa.JpaCmpEngine.executeQuery > (JpaCmpEngine.java:261) > > Is this supposed to work? If not, maybe we should throw the > exception when getting the query. > > In the mean time I'll code around this. > > -dain