[cdi-dev] CDI + transactions query

Jens Schumann jens.schumann at openknowledge.de
Thu Aug 30 03:00:57 EDT 2012

Marina, Paul:

I think most of what we need is already covered by
http://java.net/jira/browse/JTA_SPEC-5. I created
http://java.net/jira/browse/JTA_SPEC-6 to cover the
beforeCompletion/afterCompletion ambiguities.

Thanks so far. We should move further discussions to the JTA spec list.


Am 28.08.12 01:39 schrieb "Marina Vatkina" unter
<marina.vatkina at oracle.com>:

>Jens Schumann wrote:
>> Am 25.08.12 00:11 schrieb "Marina Vatkina" unter
>> <marina.vatkina at oracle.com>:
>>> You can mark a transaction for rollback inside the beforeCompletion
>>> callback.
>>> BeforCompletion callback is part of the transaction commit process, so
>>> it's too late to request a commit. Nested transactions are not required
>>> to be supported, but you should be able to suspend/resume an active
>>> transaction to run a RequiresNew logic.
>>> AfterCompletion callback is called after all transaction processing has
>>> been finished.
>> Thanks for clarification. Just found similar statements in the EJB spec
>> (Didn't expect it there though).
>> Would you agree with my comment in
>> that CDI should rely on what's already specified for the platform,
>> especially for container and bean managed transactions and JTA
>> synchronization callbacks?
>It should. But for a BMT transactions, an observer can start a
>transaction, if none is in progress. It should then in most cases
>complete the transaction (stateful session beans allow transaction
>completion at a later time).
>>  If so we have to discuss wether CMT/BMT
>> semantics should be part of the EJB spec and wether the current JTA or
>> Java EE spec has to include clarifications like yours above.
>> I have to admit that I do not follow the current JTA spec works nor do I
>> understand the (political) requirements/consequences if the content of
>> chapter 13 EJB 3.1 spec gets moved to a better location.
>Unfortunately the EJB spec can't just move its transaction support to
>another spec (or platform spec for that matter) - it relies on javax.ejb
>package, which can't be split into pieces, and we can't just drop the
>"old" EJB way for backward compatibility.
>>  I would hope this
>> will already happen while introducing @Transactional/TransactionScope.
>It will be added to the JTA spec (Paul sent the pointers).
>> Jens

More information about the cdi-dev mailing list