Author: epbernard
Date: 2006-08-24 00:43:46 -0400 (Thu, 24 Aug 2006)
New Revision: 10330
Modified:
trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/AbstractEntityManagerImpl.java
Log:
EJB-218 throw the original exception and log the subsequent one
Modified:
trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/AbstractEntityManagerImpl.java
===================================================================
---
trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/AbstractEntityManagerImpl.java 2006-08-24
04:21:26 UTC (rev 10329)
+++
trunk/HibernateExt/ejb/src/java/org/hibernate/ejb/AbstractEntityManagerImpl.java 2006-08-24
04:43:46 UTC (rev 10330)
@@ -582,7 +582,15 @@
}
public void throwPersistenceException(PersistenceException e) {
- if ( ! ( e instanceof NoResultException || ( e instanceof NonUniqueResultException ) )
) markAsRollback();
+ if ( ! ( e instanceof NoResultException || ( e instanceof NonUniqueResultException ) )
) {
+ try {
+ markAsRollback();
+ }
+ catch (Exception ne) {
+ //we do not want the subsequent exception to swallow the original one
+ log.error( "Unable to mark for rollback on PersistenceException: ", ne);
+ }
+ }
throw e;
}
@@ -620,7 +628,13 @@
throw new IllegalArgumentException( e );
}
else if ( e instanceof TransientObjectException ) {
- markAsRollback();
+ try {
+ markAsRollback();
+ }
+ catch (Exception ne) {
+ //we do not want the subsequent exception to swallow the original one
+ log.error( "Unable to mark for rollback on TransientObjectException: ",
ne);
+ }
throw new IllegalStateException( e ); //Spec 3.2.3 Synchronization rules
}
else {
Show replies by date