[cdi-dev] CDI + transactions query

Paul Parkinson paul.parkinson at oracle.com
Mon Aug 27 14:58:59 EDT 2012


Hello,

I would agree with the general approach/alignment that "CDI should rely on what's already specified for the platform especially for container and bean managed transactions and JTA synchronization callbacks" and that any ambiguous, etc. factors should be addressed in the JTA group/spec.  Related links:
http://java.net/projects/jta-spec 
users at jta-spec.java.net  
http://java.net/jira/browse/JTA_SPEC  .  

The CMT/EJB/CDI @Transactional/TransactionScopeaspect is being covered here: http://java.net/jira/browse/JTA_SPEC-5

I think that may still leave the finer clarification of what is legal in beforeCompletion.  The introduction of the TransactionSynchronizationRegistry resulted in elaborating on the specification of Synchronization behavior (and of course beforeCompletion) as so the chapter 5 API ref is a better place to look, but indeed things like the ability to suspend/resume in a beforeCompletion method are not specified (the spec would actually seem to suggest that would not be legal/portable but at the same time I know it is possible, and likely used, in most if not all appservers).

Thanks,
Paul

On Aug 25, 2012, at 4:55 AM, 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? 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. I would hope this
> will already happen while introducing @Transactional/TransactionScope.
> 
> Jens
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20120827/ddcc0e00/attachment.html 


More information about the cdi-dev mailing list