First, I'm not an expert that's just my way to manage exception !

I do not manage my exception in the same way as yours.

First, if you want log exception and throw another exception, you may perhaps 
consider to use JBoss AOP interceptor in order not to make your source code 
more complex.

Now my way to manage exception is the following (it's my solution, maybe that's 
not good):
Usually I do not catch exception for my DAO (it means that if a runtime 
exception is thrown it may rollback the JTA transaction) and I have added an 
interceptor on all methods of remote session bean and MDB. This interceptor is 
in charge to log the exception and to modifiy throw a new exception (this 
exception as a ref on the logged exception. I often have swing client, I log 
exception on server side to be sure to have a log - if i just leave the 
exception go to client side, usualy client does not have in its classpath one 
of the chained exception).
In some cases, when the exception thrown is a error case (not a bug in my 
code), in the session bean, I cacth the excpetion, log it and usualy throw an 
exception with an ApplicationException annotation with a rollback=false. 
Consequently the exception does not rollback the JTA transaction. This 
exception is not a Runtime consequently, invoker has to manage the exception.

To summarize:
- consider using JBoss AOP inteceptor
- Consider using ApplicationException annotation
You probably will have more flexibility for your exception management and a 
easier code to write.

I'm interesting to know what's your feeling about that !

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3972007#3972007

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3972007
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to