Hi Amit,Is the NoResultException the only exception in your transaction? If so, I agree that this should not roll back the transaction. And please file a JIRA for this.
"Surely there is a TCK test case" that covers this situation? Craig On Nov 21, 2009, at 6:25 AM, Amit Puri wrote:
Hi AllI have a weird problem out here which seems to be violating the JPA 1.0specification.One of my query which throws a NoResultException results in the completetransaction 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 problemoccurs. It may be thrown to report that the invoked operation could notcomplete 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 thePersistenceException. 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 candidatetype "class -------" with filter"---------------------------------------------------" was configured to havea 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: Committingtransaction org.apache.geronimo.transaction.manager.transactioni...@4d004d2009-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 thatoccurred. atorg .apache.openjpa.kernel.BrokerImpl.newFlushException(BrokerImpl.java: 2163)at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2010) ------------------------------------------------------------------------------------------- Please clarify. Thanks Amit
Craig L Russell Architect, Sun Java Enterprise System http://db.apache.org/jdo 408 276-5638 mailto:[email protected] P.S. A good JDO? O, Gasp!
smime.p7s
Description: S/MIME cryptographic signature
