openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amit Puri (JIRA)" <j...@apache.org>
Subject [jira] Created: (OPENJPA-1399) NoResultException results in the complete transaction being rollled back
Date Mon, 23 Nov 2009 11:09:39 GMT
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
<openjpa-1.2.1-r2180:4612 nonfatal user error> 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
<openjpa-1.2.1-r2180:4612 fatal general error> 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: 
<openjpa-1.2.1-r2180:4612 nonfatal general error> 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.


Mime
View raw message