From dev-return-14281-apmail-openjpa-dev-archive=openjpa.apache.org@openjpa.apache.org Mon Nov 23 11:10:04 2009 Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 2633 invoked from network); 23 Nov 2009 11:10:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 23 Nov 2009 11:10:04 -0000 Received: (qmail 63606 invoked by uid 500); 23 Nov 2009 11:10:04 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 63542 invoked by uid 500); 23 Nov 2009 11:10:04 -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 63529 invoked by uid 99); 23 Nov 2009 11:10:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Nov 2009 11:10:04 +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; Mon, 23 Nov 2009 11:10:01 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 95CB1234C04C for ; Mon, 23 Nov 2009 03:09:39 -0800 (PST) Message-ID: <1107869994.1258974579598.JavaMail.jira@brutus> Date: Mon, 23 Nov 2009 11:09:39 +0000 (UTC) From: "Amit Puri (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Created: (OPENJPA-1399) NoResultException results in the complete transaction being rollled back 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 NoResultException results in the complete transaction being rollled back ------------------------------------------------------------------------ Key: OPENJPA-1399 URL: https://issues.apache.org/jira/browse/OPENJPA-1399 Project: OpenJPA Issue Type: Bug Components: jpa Affects Versions: 1.2.1 Environment: Windows, Geronimo 214, DB2 Reporter: Amit Puri One of my query which throws a NoResultException results in the complete transaction being rollled back. Here is the exception trace. ------------------------------------------------------------------------------------------- 2009-11-18 18:53:26,671 ERROR [SessionHelper] error in ***** method org.apache.openjpa.persistence.NoResultException: The query on candidate type "class -------.entities.Session" with filter "select s from Session s where ---- = :-- AND ---- IS NULL and -------- ='1'" was configured to have a unique result, but no instance matched the query. at org.apache.openjpa.kernel.QueryImpl.singleResult(QueryImpl.java:1299) at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1221) at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:990) at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:848) at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:779) at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:525) at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:254) at org.apache.openjpa.persistence.QueryImpl.getSingleResult(QueryImpl.java:317) at ------.helper.sessionmgmt.SessionHelper.signOn(SessionHelper.java:55) at ------.ejb.sessionbean.sessionmgmt.SessionManagement.signOn(SessionManagement.java:75) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:599) at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:158) at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:141) at org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:67) at org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:210) at org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:188) at org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:165) at org.apache.openejb.server.ejbd.EjbRequestHandler.doEjbObject_BUSINESS_METHOD(EjbRequestHandler.java:238) at org.apache.openejb.server.ejbd.EjbRequestHandler.processRequest(EjbRequestHandler.java:129) at org.apache.openejb.server.ejbd.EjbDaemon.processEjbRequest(EjbDaemon.java:164) at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:122) at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:84) at org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:60) at org.apache.openejb.server.ServicePool$2.run(ServicePool.java:78) at org.apache.openejb.server.ServicePool$3.run(ServicePool.java:101) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:896) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:735) 2009-11-18 18:53:32,546 INFO [Transaction] TX Required: Committing transaction org.apache.geronimo.transaction.manager.TransactionImpl@6c396c39 2009-11-18 18:53:33,765 WARN [Transaction] Unexpected exception from beforeCompletion; transaction will roll back org.apache.openjpa.persistence.PersistenceException: The transaction has been rolled back. See the nested exceptions for details on the errors that occurred. at org.apache.openjpa.kernel.BrokerImpl.newFlushException(BrokerImpl.java:2163) at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2010) at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:1908) at org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1826) at org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:522) at org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:507) at org.apache.geronimo.transaction.manager.TransactionImpl.beforePrepare(TransactionImpl.java:400) at org.apache.geronimo.transaction.manager.TransactionImpl.commit(TransactionImpl.java:260) at org.apache.geronimo.transaction.manager.TransactionManagerImpl.commit(TransactionManagerImpl.java:250) at org.apache.openejb.core.transaction.TransactionPolicy.commitTransaction(TransactionPolicy.java:138) at org.apache.openejb.core.transaction.TxRequired.afterInvoke(TxRequired.java:76) at org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:212) at org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:188) at org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:165) at org.apache.openejb.server.ejbd.EjbRequestHandler.doEjbObject_BUSINESS_METHOD(EjbRequestHandler.java:238) at org.apache.openejb.server.ejbd.EjbRequestHandler.processRequest(EjbRequestHandler.java:129) at org.apache.openejb.server.ejbd.EjbDaemon.processEjbRequest(EjbDaemon.java:164) at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:122) at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:84) at org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:60) at org.apache.openejb.server.ServicePool$2.run(ServicePool.java:78) at org.apache.openejb.server.ServicePool$3.run(ServicePool.java:101) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:896) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:735) Caused by: org.apache.openjpa.persistence.PersistenceException: DB2 SQL Error: SQLCODE=-407, SQLSTATE=23502, SQLERRMC=TBSPACEID=2, TABLEID=158, COLNO=0, DRIVER=3.50.152 ------------------------------------------------------------------------------------------- I find the following in JPA spec which clearly says that NoResultException should not result in a roll back. For your reference here is the section 3.7 of JPA spec from my copy. Section 3.7 of the JPA 1.0 spec states that: ------------------------------------------------------------------------------------------ PersistenceException The PersistenceException is thrown by the persistence provider when a problem occurs. It may be thrown to report that the invoked operation could not complete because of an unexpected error (e.g., failure of the persistence provider to open a database connection). All other exceptions defined by this specification are subclasses of the PersistenceException. All instances of PersistenceException except for instances of NoResultException and NonUniqueResultException will cause the current transaction, if one is active, to be marked for rollback. ------------------------------------------------------------------------------------------- -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.