jsr345-experts@ejb-spec.java.net

[jsr345-experts] Re: Pushing _at_Transactional in the EJB spec ?

From: Antonio Goncalves <antonio.goncalves_at_gmail.com>
Date: Tue, 5 Mar 2013 17:05:41 +0100

Yes, I found it thanks :
http://java.net/projects/javaee-spec/lists/jsr342-experts/archive/2012-01/message/36

On Tue, Mar 5, 2013 at 12:43 PM, Pete Muir <pmuir_at_bleepbleep.org.uk> wrote:

> There was a long thread on the java ee group that discussed why it was
> hard to integrate with EJB annotations - in essence it's because people
> wanted a somewhat different model for @Transactional.
>
> On 5 Mar 2013, at 07:32, Marina Vatkina <marina.vatkina_at_oracle.com> wrote:
>
> > On 3/4/13 10:44 PM, Antonio Goncalves wrote:
> >> So are you saying it's better not to use them in EJBs ?
> >
> > Yes.
> >
> >> Or mixing both (EJBs and Managed Bean transactions) is not appropriate ?
> >
> > That's fine if you use them with the MBs.
> >> What happens if we have this ? Is the method propagated as expected ?
> >>
> >> @Stateless
> >> public class MyEJB {
> >>
> >> @Inject
> >> private MyBean myBean;
> >>
> >> public void defaultRequiredMethod() {
> >> myBean.defaultTxMethod();
> >> }
> >> }
> >>
> >> @Transactional
> >> public class MyBean {
> >>
> >> public void defaultRequiredMethod() {
> >> myBean.defaultTxMethod();
> >> }
> >> }
> >>
> >
> > I'm not sure about the last call - if myBean is not a proxy, it's not
> intercepted. Otherwise EJBs continue to work as they did before - it's just
> the incoming transaction now can be started by the container for non-EJB
> components, vs. before they needed to use UserTransaction to do so. And the
> CDI beans (CDI shouldn't be disabled) can now utilize CMT transactions
> following the same rules as the EJBs did all the time.
> >
> > HTH,
> > -marina
> >
> >>
> >> On Tue, Mar 5, 2013 at 5:44 AM, Marina Vatkina <
> marina.vatkina_at_oracle.com> wrote:
> >> It's noted in the JTA spec and somewhat in the Interceptors spec
> already and I planned to add a word of caution on the Tx interceptors to
> the EJB spec. The problem with these interceptors is that they are CDI
> interceptors and as such are invoked after the @Interceptors interceptor
> and may change tx context if they are not the same as the EJB settings.
> >>
> >> -marina
> >>
> >>
> >> On 3/4/13 7:57 AM, Antonio Goncalves wrote:
> >>> I was reading the JTA JIRAs about the Transactional model in Managed
> Beans (http://java.net/jira/browse/JTA_SPEC-5). It will be using the new
> interceptor binding @javax.transaction.Transactional with a TrxType
> (REQUIRED, REQUIRES_NEW...) :
> >>>
> >>> @Inherited
> >>> @InterceptorBinding
> >>> @Target({TYPE,METHOD})
> >>> @Retention(RUNTIME)
> >>> public @interface Transactional { TxType value() default
> TxType.REQUIRED }
> >>>
> >>> public enum TxType { REQUIRED, REQUIRES_NEW, MANDATORY, SUPPORTS,
> NOT_SUPPORTED, NEVER }
> >>>
> >>>
> >>> There is nothing about @Transactional in the EJB spec. Why don't we
> push the new @Transactional model into EJBs ? This way developers would be
> encouraged to use @Transactional all over the plateform and start
> forgetting about javax.ejb.TransactionAttribute.
> >>>
> >>> What do you think ?
> >>>
> >>>
> >>> --
> >>> Antonio Goncalves
> >>> Software architect and Java Champion
> >>>
> >>> Web site | Twitter | LinkedIn | Paris JUG | Devoxx France
> >>
> >>
> >>
> >>
> >> --
> >> Antonio Goncalves
> >> Software architect and Java Champion
> >>
> >> Web site | Twitter | LinkedIn | Paris JUG | Devoxx France
> >
>
>


-- 
Antonio Goncalves
Software architect and Java Champion
Web site <http://www.antoniogoncalves.org> |
Twitter<http://twitter.com/agoncal>|
LinkedIn <http://www.linkedin.com/in/agoncal> | Paris
JUG<http://www.parisjug.org> |
Devoxx France <http://www.devoxx.fr>