You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@aries.apache.org by Andy Schmidt <An...@kisters.de> on 2015/03/13 08:47:37 UTC

Aries Transactions Rollback on Declared Exceptions

Hallo,

I am currently using the Karaf 3.0.3 with the Aries JPA and Transaction 
feature. In addition I am using hibernate as JPA implementation.
Normally all is working fine. The transaction is opened by calling my 
methods on the service/application layer and the entities are persisted 
with hibernate and commited via JTA. But the rollback is only be triggered 
with RuntimeExceptions or Errors. I dived into the Aries Transaction 
Source Code and found an interceptor with the postCallWithException 
method. There contains the following code:

Transaction tran = token.getActiveTransaction();
             if (tran != null) {
                 if (ex instanceof RuntimeException || ex instanceof 
Error) {
                     tran.setRollbackOnly();
                 } else {
                     //declared exception, we don't set rollback
                 }
             }

This code says the rollback is only be done if a RuntimeException or Error 
occurres. Declared exceptions are irgnored. In Java EE the 
ApplicationContext annotation with an attribute rollback=[true/false] was 
defined to declare an user defined application exception for rollback if 
this exceptions was thrown. I am missing this feature in Aries Transaction 
or a feature to declared in within the blueprint xml configuration.

Is there another way to define declared exceptions for rollback with Aries 
Transaction?

Best regards, Andy
--------------------------------------------------------------------------------------------------------------------------------------------
 Andy Schmidt - KISTERS AG - Pascalstraße 8+10 - 52076 Aachen - Germany
Handelsregister Aachen, HRB-Nr. 7838 | Vorstand: Klaus Kisters, Hanns Kisters | Aufsichtsratsvorsitzender: Dr. Thomas Klevers
Phone: +49 2408 9385 -449 | Fax: +49 2408 9385 -555 | E-Mail: Andy.Schmidt@kisters.de | WWW: http://www.kisters.de
--------------------------------------------------------------------------------------------------------------------------------------------
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet. 
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.