Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jta-dev] Handling java.lang.Error within the CDI interceptor

Hello,

I'm Ondra Chaloupka, a member of the Narayana team. Recently we've got a question from a user about handling of java.lang.Error thrown in a method of a CDI bean. The question is if a transaction started by the CDI @Transactional  interceptor should be marked for rollback.

As I was reading the current JTA specification it's not clear (at least to me). The spec says

By default checked exceptions do not result in the transactional interceptor marking the transaction for rollback and instances of RuntimeException and its subclasses do.

There is not said what to do with other un-checked exceptions. There is mentioned explicitly only the RuntimeTransaction here.
On the other hand, the text about Synchronization says that

An unchecked exception thrown by a registered Synchronization object causes the transaction to be aborted.

Should not be changed the text about CDI @Transactional interceptor in the same way - i.e. from explicit RuntimeException to term 'unchecked exception'?

Thank you,
Ondra

Back to the top