Hi,

I was just looking at HHH-4676 - "Any interceptor exception (RTE) should  
mark the tx for rollback"
and was wondering whether we can generally say that in JPA any  
RuntimeException will mark the current
transaction for a rollback.

Currently we have this in AbstractEntityManagerImpl:


        public RuntimeException convert(RuntimeException e) {
                RuntimeException result = e;
                if ( e instanceof HibernateException ) {
                        result = convert( (HibernateException) e );
                }
                else if (e instanceof ConstraintViolationException) {
                        markAsRollback();
                }
                //if any RT exception should mark the tx for rollback, convert 
the last  
else if into a else
                return result;
        }



Should this be changed to:


        public RuntimeException convert(RuntimeException e) {
                RuntimeException result = e;
                if ( e instanceof HibernateException ) {
                        result = convert( ( HibernateException ) e, null );
                }
                else {
                        markAsRollback();
                }
                return result;
        }

Meaning all RuntimeExceptions will mark the current transaction for  
rollback? Any comments?

--Hardy
_______________________________________________
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

Reply via email to