If one of my EJB's has an annotation of type @TransactionTimeout(120) and I have a transaction longer than that the container will throw an Exception. My question is ... can I add some specific data that I want to the exception being thrown? I would like that in some cases the Exception to contain some specific details for that when I catch the timeout exception I can do some further processings or not which will finally result in rolling back the transaction or not.
Any help is greatly appreciated.
since Exceptions should be immutable, it's very likely that there is no possibility. But you could try to use Interceptors which wrap your call, there you could do some processing.