[cdi-dev] CDI + transactions query

Marina Vatkina marina.vatkina at oracle.com
Mon Aug 27 19:39:08 EDT 2012


Jens,

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 https://issues.jboss.org/browse/CDI-213
> 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).

-marina
> Jens
>
>   


More information about the cdi-dev mailing list