Hi All

I have a weird problem out here which seems to be violating the JPA 1.0
specification.
One of my query which throws a NoResultException results in the complete
transaction being
rollled back.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.
-------------------------------------------------------------------------------------------

Here is the exception trace.

-------------------------------------------------------------------------------------------
2009-11-19 12:15:58,531 ERROR <openjpa-1.2.1-r2180:4612 nonfatal user error>
org.apache.openjpa.persistence.NoResultException: The query on candidate
type "class -------" with filter
"---------------------------------------------------" 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)
...
...
2009-11-19 12:16:04,281 INFO  [Transaction] TX Required: Committing
transaction org.apache.geronimo.transaction.manager.transactioni...@4d004d
2009-11-19 12:16:04,640 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)
-------------------------------------------------------------------------------------------

Please clarify.

Thanks
Amit

Reply via email to