users@jta-spec.java.net

[jta-spec users] Re: "clarify a potential conflict between JTA and CDI"

From: Paul Parkinson <paul.parkinson_at_oracle.com>
Date: Wed, 20 Mar 2013 20:45:00 -0400

fyi, just to also closing the loop on this list: https://issues.jboss.org/browse/CDI-355 is closed/resolved with the following CDI spec addition/inclusion:

"a method of a bean via a non-contextual reference to the bean, if the instance was created by the container (e.g. using InjectionTarget.produce()or UnmanagedInstance.produce()),"

On Mar 18, 2013, at 6:29 PM, Ian Robinson wrote:

> Adding onto the JTA list since we need this issue clarified as part of the discussion on the closing the JTA 1.2 MR.
> I'm equally interested in the discussion around the question Joe asks about *how* interceptors are supposed to be involved in non-contextual references.
>
> Regards,
> Ian
>
>
>
>
>
> From: Pete Muir <pmuir_at_redhat.com>
> To: Joseph Bergmark <bergmark_at_us.ibm.com>,
> Cc: Ian Robinson/UK/IBM_at_IBMGB
> Date: 18/03/2013 15:20
> Subject: Re: "clarify a potential conflict between JTA and CDI"
>
>
>
> Thanks Joe.
>
> On 18 Mar 2013, at 13:21, Joseph Bergmark <bergmark_at_us.ibm.com> wrote:
>
> > I've opened: https://issues.jboss.org/browse/CDI-355
> >
> > To be honest I always through this was working as designed, and in fact I've even quoted it to customers a few times. If CDI isn't given an opportunity to participate in the creation of the instance (i.e. non contextual instance), how would the container have a hook point to be able to run interceptors when methods are called on that instance?
> >
> > Sincerely,
> >
> > Joe Bergmark
> > WebSphere Development
> > bergmark_at_us.ibm.com
> > (919)254-9925
> >
> >
> > From: Pete Muir <pmuir_at_redhat.com>
> > To: Joseph Bergmark/Durham/IBM_at_IBMUS,
> > Cc: Ian Robinson <ian_robinson_at_uk.ibm.com>
> > Date: 03/18/2013 08:15 AM
> > Subject: Re: "clarify a potential conflict between JTA and CDI"
> >
> >
> >
> >
> >
> > On 18 Mar 2013, at 12:13, Joseph Bergmark <bergmark_at_us.ibm.com> wrote:
> >
> > > What specifically do you think is the bug so I can make sure I file it clearly? That interceptors and decorators only apply to contextual references
> >
> > This :-)
> >
> >
> > > or EJBs?
> > >
> > > Sincerely,
> > >
> > > Joe Bergmark
> > > WebSphere Development
> > > bergmark_at_us.ibm.com
> > > (919)254-9925
> > >
> > >
> > > From: Pete Muir <pmuir_at_redhat.com>
> > > To: Paul Parkinson <paul.parkinson_at_oracle.com>,
> > > Cc: users_at_jta-spec.java.net, JJ Snyder <J.J.SNYDER_at_oracle.com>, Linda DeMichiel <linda.demichiel_at_oracle.com>, Kevin Sutter/Rochester/IBM_at_IBMUS, Joseph Bergmark/Durham/IBM_at_IBMUS, Ian Robinson <ian_robinson_at_uk.ibm.com>
> > > Date: 03/18/2013 07:32 AM
> > > Subject: Re: "clarify a potential conflict between JTA and CDI"
> > >
> > >
> > >
> > >
> > > Ian, this is a bug in CDI, could you or Joe file a CDI issue in http://issues.jboss.org/browse/CDI and set the Fix Version to 1.1.FD, so that I can address it!
> > >
> > > Thanks!
> > >
> > > On 15 Mar 2013, at 23:05, Paul Parkinson <paul.parkinson_at_oracle.com> wrote:
> > >
> > > > Hello JJ and Pete,
> > > >
> > > > As you know we have two new JTA annotations (Transactional and TransactionScoped) in JTA1.2 that provide support in CDI.
> > > > The current JTA 1.2 spec/MR describing these can be found here: http://java.net/projects/jta-spec/sources/spec-source-repository/content/JTA1.2Specification.pdf?rev=6
> > > >
> > > > Could I ask your help to resolve/clarify Ian's question below?
> > > >
> > > > Thanks,
> > > > Paul
> > > >
> > > > On Mar 14, 2013, at 2:43 PM, Ian Robinson wrote:
> > > >
> > > >>
> > > >> - I believe we need to additionally clarify a potential conflict between JTA and CDI: servlets, JAX-RS resource classes, and JAX-WS service endpoints are created by their containers with non-contextual references (according to the platform specification EE 5.24 and in our implementation) but the CDI spec (section 7.2) precludes bean with non-contextual references from being intercepted:
> > > >>
> > > >> 7.2. Container invocations and interception
> > > >> When the application invokes:
> > > >> • a method of a bean via a contextual reference to the bean, as defined in Section 6.5.3, “Contextual reference for a
> > > >> bean”, or
> > > >> • a business method of a session bean via an EJB remote or local reference,
> > > >> the invocation is treated as a business method invocation.
> > > >>
> > > >> --snip--
> > > >>
> > > >> If, and only if, an invocation is a business method invocation:
> > > >> • it passes through method interceptors and decorators, and
> > > >> • in the case of a session bean, it is subject to EJB services such as declarative transaction management, concurrency, se-
> > > >> curity and asynchronicity, as defined by the EJB specification.
> > > >> Otherwise, the invocation is treated as a normal Java method call and is not intercepted by the container.
> > > >>
> > > >>
> > > >> It seems like CDI 7.2 needs to extend the scope of "business method of a session bean via an EJB remote or local reference" to include @Transactional beans with non-contextual references. Can you confirm whether this interpretation is correct and, if so, how the CDI spec could be changed to be consistent?
> > > >
> > >
> > >
> >
> >
>
>
>
>
> Unless stated otherwise above:
> IBM United Kingdom Limited - Registered in England and Wales with number 741598.
> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU