You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Lars-Fredrik Smedberg <it...@gmail.com> on 2016/06/16 10:33:51 UTC

Question on CDI, JTA and EJB

Hi

Some parts of this is WELD specific and I know Tomee uses OWB but other
parts are questions more to whats in the specs....

In the EJB 3.2 spec in section 7.1 I can read

"It is illegal to associate JTA transactional interceptors (see [8]) with
Enterprise JavaBeans. The EJB
Container should fail deployment of such applications.[39]"

And when starting the my container (I have tried it in WLP) I get an error
when trying to use @Transactional on a @MessageDriven bean which seems okay
according to the EJB spec.

However when reading the WELD reference section 15.4 (
http://docs.jboss.org/weld/reference/latest/en-US/html_single/#_calling_a_bean_from_a_message_driven_bean)
I see the following example:

@Transactional @MessageDriven
public class ProcessOrder implements MessageListener {
   @Inject Inventory inventory;
   @PersistenceContext EntityManager em;

   public void onMessage(Message message) {
      ...
   }
}

The text however does not mention the @Transactional interceptor
specifically but rather state that:

"You can even use interceptor bindings for message-driven Beans."

*Question:*

- Is the example using @Transactional not a good example since this is not
permitted according to the EJB spec or is MDBs a special case where it
should be permitted?

Regards
Lars-Fredrik



-- 
Med vänlig hälsning / Best regards

Lars-Fredrik Smedberg

STATEMENT OF CONFIDENTIALITY:
The information contained in this electronic message and any
attachments to this message are intended for the exclusive use of the
address(es) and may contain confidential or privileged information. If
you are not the intended recipient, please notify Lars-Fredrik Smedberg
immediately at itsmeden@gmail.com, and destroy all copies of this
message and any attachments.

Re: Question on CDI, JTA and EJB

Posted by Lars-Fredrik Smedberg <it...@gmail.com>.
👌👍
On Jun 16, 2016 13:23, "Romain Manni-Bucau" <rm...@gmail.com> wrote:

> Yep think so. Until we are foced to support it i dont see any valid reason
> to fail for this case - which is valid user point of view.
>
> Only pitfall I see is conflicting annotations but defaults should be fine.
> Le 16 juin 2016 13:08, "Lars-Fredrik Smedberg" <it...@gmail.com> a
> écrit :
>
> > Thanks for the reply Romain ... out of curiosity does Tomee allow it?
> >
> > Regards
> > LF
> > On Jun 16, 2016 13:02, "Romain Manni-Bucau" <rm...@gmail.com>
> wrote:
> >
> > > You read it right but spec also states this  an be removed in fiture
> > > releases.
> > >
> > > Not sure why it has been done this way to be honest
> > > Le 16 juin 2016 12:34, "Lars-Fredrik Smedberg" <it...@gmail.com> a
> > > écrit :
> > >
> > > > Hi
> > > >
> > > > Some parts of this is WELD specific and I know Tomee uses OWB but
> other
> > > > parts are questions more to whats in the specs....
> > > >
> > > > In the EJB 3.2 spec in section 7.1 I can read
> > > >
> > > > "It is illegal to associate JTA transactional interceptors (see [8])
> > with
> > > > Enterprise JavaBeans. The EJB
> > > > Container should fail deployment of such applications.[39]"
> > > >
> > > > And when starting the my container (I have tried it in WLP) I get an
> > > error
> > > > when trying to use @Transactional on a @MessageDriven bean which
> seems
> > > okay
> > > > according to the EJB spec.
> > > >
> > > > However when reading the WELD reference section 15.4 (
> > > >
> > > >
> > >
> >
> http://docs.jboss.org/weld/reference/latest/en-US/html_single/#_calling_a_bean_from_a_message_driven_bean
> > > > )
> > > > I see the following example:
> > > >
> > > > @Transactional @MessageDriven
> > > > public class ProcessOrder implements MessageListener {
> > > >    @Inject Inventory inventory;
> > > >    @PersistenceContext EntityManager em;
> > > >
> > > >    public void onMessage(Message message) {
> > > >       ...
> > > >    }
> > > > }
> > > >
> > > > The text however does not mention the @Transactional interceptor
> > > > specifically but rather state that:
> > > >
> > > > "You can even use interceptor bindings for message-driven Beans."
> > > >
> > > > *Question:*
> > > >
> > > > - Is the example using @Transactional not a good example since this
> is
> > > not
> > > > permitted according to the EJB spec or is MDBs a special case where
> it
> > > > should be permitted?
> > > >
> > > > Regards
> > > > Lars-Fredrik
> > > >
> > > >
> > > >
> > > > --
> > > > Med vänlig hälsning / Best regards
> > > >
> > > > Lars-Fredrik Smedberg
> > > >
> > > > STATEMENT OF CONFIDENTIALITY:
> > > > The information contained in this electronic message and any
> > > > attachments to this message are intended for the exclusive use of the
> > > > address(es) and may contain confidential or privileged information.
> If
> > > > you are not the intended recipient, please notify Lars-Fredrik
> Smedberg
> > > > immediately at itsmeden@gmail.com, and destroy all copies of this
> > > > message and any attachments.
> > > >
> > >
> >
>

Re: Question on CDI, JTA and EJB

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Yep think so. Until we are foced to support it i dont see any valid reason
to fail for this case - which is valid user point of view.

Only pitfall I see is conflicting annotations but defaults should be fine.
Le 16 juin 2016 13:08, "Lars-Fredrik Smedberg" <it...@gmail.com> a
écrit :

> Thanks for the reply Romain ... out of curiosity does Tomee allow it?
>
> Regards
> LF
> On Jun 16, 2016 13:02, "Romain Manni-Bucau" <rm...@gmail.com> wrote:
>
> > You read it right but spec also states this  an be removed in fiture
> > releases.
> >
> > Not sure why it has been done this way to be honest
> > Le 16 juin 2016 12:34, "Lars-Fredrik Smedberg" <it...@gmail.com> a
> > écrit :
> >
> > > Hi
> > >
> > > Some parts of this is WELD specific and I know Tomee uses OWB but other
> > > parts are questions more to whats in the specs....
> > >
> > > In the EJB 3.2 spec in section 7.1 I can read
> > >
> > > "It is illegal to associate JTA transactional interceptors (see [8])
> with
> > > Enterprise JavaBeans. The EJB
> > > Container should fail deployment of such applications.[39]"
> > >
> > > And when starting the my container (I have tried it in WLP) I get an
> > error
> > > when trying to use @Transactional on a @MessageDriven bean which seems
> > okay
> > > according to the EJB spec.
> > >
> > > However when reading the WELD reference section 15.4 (
> > >
> > >
> >
> http://docs.jboss.org/weld/reference/latest/en-US/html_single/#_calling_a_bean_from_a_message_driven_bean
> > > )
> > > I see the following example:
> > >
> > > @Transactional @MessageDriven
> > > public class ProcessOrder implements MessageListener {
> > >    @Inject Inventory inventory;
> > >    @PersistenceContext EntityManager em;
> > >
> > >    public void onMessage(Message message) {
> > >       ...
> > >    }
> > > }
> > >
> > > The text however does not mention the @Transactional interceptor
> > > specifically but rather state that:
> > >
> > > "You can even use interceptor bindings for message-driven Beans."
> > >
> > > *Question:*
> > >
> > > - Is the example using @Transactional not a good example since this is
> > not
> > > permitted according to the EJB spec or is MDBs a special case where it
> > > should be permitted?
> > >
> > > Regards
> > > Lars-Fredrik
> > >
> > >
> > >
> > > --
> > > Med vänlig hälsning / Best regards
> > >
> > > Lars-Fredrik Smedberg
> > >
> > > STATEMENT OF CONFIDENTIALITY:
> > > The information contained in this electronic message and any
> > > attachments to this message are intended for the exclusive use of the
> > > address(es) and may contain confidential or privileged information. If
> > > you are not the intended recipient, please notify Lars-Fredrik Smedberg
> > > immediately at itsmeden@gmail.com, and destroy all copies of this
> > > message and any attachments.
> > >
> >
>

Re: Question on CDI, JTA and EJB

Posted by Lars-Fredrik Smedberg <it...@gmail.com>.
Thanks for the reply Romain ... out of curiosity does Tomee allow it?

Regards
LF
On Jun 16, 2016 13:02, "Romain Manni-Bucau" <rm...@gmail.com> wrote:

> You read it right but spec also states this  an be removed in fiture
> releases.
>
> Not sure why it has been done this way to be honest
> Le 16 juin 2016 12:34, "Lars-Fredrik Smedberg" <it...@gmail.com> a
> écrit :
>
> > Hi
> >
> > Some parts of this is WELD specific and I know Tomee uses OWB but other
> > parts are questions more to whats in the specs....
> >
> > In the EJB 3.2 spec in section 7.1 I can read
> >
> > "It is illegal to associate JTA transactional interceptors (see [8]) with
> > Enterprise JavaBeans. The EJB
> > Container should fail deployment of such applications.[39]"
> >
> > And when starting the my container (I have tried it in WLP) I get an
> error
> > when trying to use @Transactional on a @MessageDriven bean which seems
> okay
> > according to the EJB spec.
> >
> > However when reading the WELD reference section 15.4 (
> >
> >
> http://docs.jboss.org/weld/reference/latest/en-US/html_single/#_calling_a_bean_from_a_message_driven_bean
> > )
> > I see the following example:
> >
> > @Transactional @MessageDriven
> > public class ProcessOrder implements MessageListener {
> >    @Inject Inventory inventory;
> >    @PersistenceContext EntityManager em;
> >
> >    public void onMessage(Message message) {
> >       ...
> >    }
> > }
> >
> > The text however does not mention the @Transactional interceptor
> > specifically but rather state that:
> >
> > "You can even use interceptor bindings for message-driven Beans."
> >
> > *Question:*
> >
> > - Is the example using @Transactional not a good example since this is
> not
> > permitted according to the EJB spec or is MDBs a special case where it
> > should be permitted?
> >
> > Regards
> > Lars-Fredrik
> >
> >
> >
> > --
> > Med vänlig hälsning / Best regards
> >
> > Lars-Fredrik Smedberg
> >
> > STATEMENT OF CONFIDENTIALITY:
> > The information contained in this electronic message and any
> > attachments to this message are intended for the exclusive use of the
> > address(es) and may contain confidential or privileged information. If
> > you are not the intended recipient, please notify Lars-Fredrik Smedberg
> > immediately at itsmeden@gmail.com, and destroy all copies of this
> > message and any attachments.
> >
>

Re: Question on CDI, JTA and EJB

Posted by Romain Manni-Bucau <rm...@gmail.com>.
You read it right but spec also states this  an be removed in fiture
releases.

Not sure why it has been done this way to be honest
Le 16 juin 2016 12:34, "Lars-Fredrik Smedberg" <it...@gmail.com> a
écrit :

> Hi
>
> Some parts of this is WELD specific and I know Tomee uses OWB but other
> parts are questions more to whats in the specs....
>
> In the EJB 3.2 spec in section 7.1 I can read
>
> "It is illegal to associate JTA transactional interceptors (see [8]) with
> Enterprise JavaBeans. The EJB
> Container should fail deployment of such applications.[39]"
>
> And when starting the my container (I have tried it in WLP) I get an error
> when trying to use @Transactional on a @MessageDriven bean which seems okay
> according to the EJB spec.
>
> However when reading the WELD reference section 15.4 (
>
> http://docs.jboss.org/weld/reference/latest/en-US/html_single/#_calling_a_bean_from_a_message_driven_bean
> )
> I see the following example:
>
> @Transactional @MessageDriven
> public class ProcessOrder implements MessageListener {
>    @Inject Inventory inventory;
>    @PersistenceContext EntityManager em;
>
>    public void onMessage(Message message) {
>       ...
>    }
> }
>
> The text however does not mention the @Transactional interceptor
> specifically but rather state that:
>
> "You can even use interceptor bindings for message-driven Beans."
>
> *Question:*
>
> - Is the example using @Transactional not a good example since this is not
> permitted according to the EJB spec or is MDBs a special case where it
> should be permitted?
>
> Regards
> Lars-Fredrik
>
>
>
> --
> Med vänlig hälsning / Best regards
>
> Lars-Fredrik Smedberg
>
> STATEMENT OF CONFIDENTIALITY:
> The information contained in this electronic message and any
> attachments to this message are intended for the exclusive use of the
> address(es) and may contain confidential or privileged information. If
> you are not the intended recipient, please notify Lars-Fredrik Smedberg
> immediately at itsmeden@gmail.com, and destroy all copies of this
> message and any attachments.
>