You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Quintin Beukes (JIRA)" <ji...@apache.org> on 2009/10/14 17:04:31 UTC

[jira] Commented: (OPENEJB-1086) Transaction policies not applied for lifecycle callback interceptor methods for @Singleton

    [ https://issues.apache.org/jira/browse/OPENEJB-1086?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12765588#action_12765588 ] 

Quintin Beukes commented on OPENEJB-1086:
-----------------------------------------

4.8.3 Transaction Semantics of Initialization and Destruction
      PostConstruct and PreDestroy methods of Singletons with container-managed transactions are transac-
      tional. From the bean developer's view there is no client of a PostConstruct or PreDestroy method.
      A PostConstruct or PreDestroy method of a Singleton with container-managed transactions has transac-
      tion attribute REQUIRED, REQUIRES_NEW, or NOT_SUPPORTED (Required , RequiresNew, or
      NotSupported if the deployment descriptor is used to specify the transaction attribute).
      Note that the container must start a new transaction if the REQUIRED (Required) transaction
      attribute is used. This guarantees, for example, that the transactional behavior of the PostConstruct
      method is the same regardless of whether it is initialized eagerly at container startup time or as a side
      effect of a first client invocation on the Singleton. The REQUIRED transaction attribute value is
      allowed so that specification of a transaction attribute for the Singleton PostConstruct/PreDestroy
      methods can be defaulted.


> Transaction policies not applied for lifecycle callback interceptor methods for @Singleton
> ------------------------------------------------------------------------------------------
>
>                 Key: OPENEJB-1086
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-1086
>             Project: OpenEJB
>          Issue Type: Bug
>    Affects Versions: 3.1.2
>            Reporter: Jean-Louis MONTEIRO
>
> OpenEJB does not seem to apply transaction policies with @Singleton beans.
> My feeling (after checking in the spec) is that we must deal with transaction policies for PostConstruct/PreDestroy lifecycle callback interceptor methods. Actually, it's not the case for @Singleton nor @Stateless whereas we do it for @Stateful.
> 4.3.14 Transaction Context of Session Bean Methods
> {quote}
> The implementation of a method defined in a session bean's business interface or component interface or no-interface view, a web service method, timeout callback  method, or singleton  PostConstruct/PreDestroy lifecycle callback interceptor method, is invoked in the scope of a transaction determined by the transaction attribute specified in the bean's metadata annotations or deployment descriptor.
> ...
> For example, it would be wrong to perform database operations within a stateful session bean's PostConstruct or PreDestroy lifecycle callback interceptor methods and to assume that the operations are part of the client's transaction. The  PostConstruct and  PreDestroy methods for stateful and stateless session beans are not controlled by a transaction attribute because handling rollbacks in these methods would greatly complicate the session instance's state diagram. 
> {quote}
> 4.3.4 Session Bean Lifecycle Callback Interceptor Methods
> {quote}
> The PostConstruct lifecycle callback interceptor methods for stateless and stateful session execute in an unspecified transaction context.
> {quote}
> 13.6 is also a good pointer.
> So, from my understanding, we should manage transaction policies in lifecycle methods for @Singleton but not necessary for @MDB @Stateless and Stateful (an unspecified transaction context).
> IMHO, we should add some consistency because the behavior for @Stateless and @Stateful is different (BTW, i didn't check for MDB).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.