<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<div>Will the spec discuss an approach for interoperability with EJB? e.g. What happens if a @Transactional CDI beans invokes a session bean (and vice versa). Will the correct transaction demarcation happen? Depending on the implementation this might already
 work automatically, but if it doesn't work it would be very confusing to users.</div>
<div><br>
</div>
<div>My other question is if JPA integration will be specified as part of this specification (e.g. @PersistenceContext in CDI beans). This is only semi related, but might be relevant.</div>
<div>Besides these questions I'm very much in favor of this approach.</div>
<div><br>
</div>
<div>Paul Bakker</div>
<div><br>
</div>
<div><br>
</div>
<div><span class="Apple-style-span" style="font-family: Times; ">
<pre>&gt;<i> From: Linda DeMichiel &lt;<a href="https://lists.jboss.org/mailman/listinfo/cdi-dev">linda.demichiel at oracle.com</a>&gt;
</i>&gt;<i> Subject: [javaee-spec users] [jsr342-experts] transactional interceptors
</i>&gt;<i> Date: 20 December 2011 23:16:38 GMT
</i>&gt;<i> To: <a href="https://lists.jboss.org/mailman/listinfo/cdi-dev">jsr342-experts at javaee-spec.java.net</a>
</i>&gt;<i> 
</i>&gt;<i> 
</i>&gt;<i> As part of better aligning managed bean technology across the
</i>&gt;<i> platform, one of the improvements we've targeted for this release
</i>&gt;<i> is the extension of &quot;container-managed&quot; transactions (CMT) beyond EJB.
</i>&gt;<i> 
</i>&gt;<i> CMT is one of the original ease-of-use facilities of EJB.  It entails
</i>&gt;<i> the specification of declarative transaction attributes on enterprise
</i>&gt;<i> bean classes or methods.  The container intercepts the corresponding
</i>&gt;<i> method calls and interposes the necessary operations to initiate,
</i>&gt;<i> suspend, or complete JTA transactions.
</i>&gt;<i> 
</i>&gt;<i> In order to allow CMT-like functionality to be more broadly supported,
</i>&gt;<i> we propose to standardize on CDI interceptors to implement transactional
</i>&gt;<i> interpositioning on managed bean methods.
</i>&gt;<i> 
</i>&gt;<i> 
</i>&gt;<i> More concretely, the proposal is the following:
</i>&gt;<i> 
</i>&gt;<i> We propose to standardize on an annotation &#43; element values that
</i>&gt;<i> capture the semantics of the current EJB transaction attributes
</i>&gt;<i> (Required, RequiresNew, Mandatory, Supports, NotSupported, Never).
</i>&gt;<i> 
</i>&gt;<i> This annotation and standardized values would be added to the
</i>&gt;<i> javax.transaction package.
</i>&gt;<i> 
</i>&gt;<i> For example, this might look as follows:
</i>&gt;<i> 
</i>&gt;<i> @Inherited
</i>&gt;<i> @InterceptorBinding
</i>&gt;<i> @Target({TYPE,METHOD})
</i>&gt;<i> @Retention(RUNTIME)
</i>&gt;<i> public @interface Transactional {
</i>&gt;<i>  TxType value() default TxType.REQUIRED
</i>&gt;<i> }
</i>&gt;<i> 
</i>&gt;<i> public enum TxType {
</i>&gt;<i>       REQUIRED,
</i>&gt;<i>       REQUIRES_NEW,
</i>&gt;<i>       MANDATORY,
</i>&gt;<i>       SUPPORTS,
</i>&gt;<i>       NOT_SUPPORTED,
</i>&gt;<i>       NEVER
</i>&gt;<i> }
</i>&gt;<i> 
</i>&gt;<i> 
</i>&gt;<i> The JTA specification would also define the semantics of the
</i>&gt;<i> corresponding interceptor classes.  (Note that the classes themselves
</i>&gt;<i> would not be defined, but left to the JTA implementation.)
</i>&gt;<i> 
</i>&gt;<i> These transactional interceptors would then be applied using the
</i>&gt;<i> standard CDI protocols.  They would be applicable to all CDI managed
</i>&gt;<i> beans as well as to classes defined as managed beans by the Java EE
</i>&gt;<i> specification such as servlets, JAX-RS resource classes, and JAX-WS
</i>&gt;<i> service endpoints.
</i>&gt;<i> 
</i>&gt;<i> 
</i>&gt;<i> There are a few open issues here that require consideration, e.g.:
</i>&gt;<i> 
</i>&gt;<i> (1) Whether the &quot;value&quot; attribute of the &quot;Transactional&quot; annotation
</i>&gt;<i> should be binding or @NonBinding.  Note that this decision affects
</i>&gt;<i> the number of interceptor classes that would need to be defined.
</i>&gt;<i> 
</i>&gt;<i> (2) Interceptor ordering.  This is currently an open topic in the CDI
</i>&gt;<i> expert group.  Presumably it would be desirable for &quot;system-level&quot;
</i>&gt;<i> interceptors such as transactional interceptors to be executed before
</i>&gt;<i> user-defined &quot;application-level&quot; interceptors, but there needs to be
</i>&gt;<i> a mechanism to allow such orderings to be specified in a flexible way.
</i>&gt;<i> 
</i>&gt;<i> 
</i>&gt;<i> We would like to get feedback on this proposed approach and the
</i>&gt;<i> related issues from the group.  Other specleads should feel free to
</i>&gt;<i> forward this message to their expert groups for further discussion, if
</i>&gt;<i> relevant.
</i>&gt;<i> 
</i>&gt;<i> thanks,
</i>&gt;<i> 
</i>&gt;<i> -Linda
</i>&gt;<i> </i></pre>
</span>
<div><br>
</div>
</div>
</body>
</html>