You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltaspike.apache.org by cchet <t....@curecomp.com> on 2013/05/12 20:18:44 UTC

ProcessAnnotatedType with EJB (deltaspike-cdictrl, openejb-lite)

I have written a cdi extension which should add a @Transactional annotation
to our @EjbService annotation which is a Stereotype and bundles all
annotations which are needed by our EJB Services.
I want to annotate it because for our JUnit tests so that we do not have to
wrap the service invocations in a TransactionalService which rpovides the
transaction.

The problem is that the TransactionalInterceptor (@Transactional) is not
taking place.
When I annotate a CDI bean (non EJB) then it works fine.
I assume that the problem is that the openEjb container has already loaded
the EJBs.

Is there a restirction i do not know ?
Is there a way to get the interceptor to be invoked ?
Is it possible to add the inteceptor the proxy via cdi extension ? 


deltaspike-cdictrl-openejb-0.3-incubating.jar
openejb-lite-4.5.0.jar

@Inherited
@TransactionManagement(TransactionManagementType.CONTAINER)
@TransactionAttribute(TransactionAttributeType.REQUIRED)
@TransactionAware
@Stereotype
@Logging
@ExceptionWrapping({
        @ExceptionWrap(
                wrapper = ConcurrentEntityUpdateException.class,
                sources = OptimisticLockException.class),
        @ExceptionWrap(
                wrapper = CoreException.class) })
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface EjbService {
}

@InterceptorBinding
@Target({
        TYPE,
        METHOD })
@Retention(RUNTIME)
@Documented
public @interface Transactional {
}

 public void handleEjbServiceannotation(@Observes
ProcessAnnotatedType<EjbService> annotatedType) {
        AnnotatedTypeBuilder<EjbService> builder = new
AnnotatedTypeBuilder<EjbService>();
        builder.readFromType(annotatedType.getAnnotatedType());
       
builder.addToClass(AnnotationInstanceProvider.of(Transactional.class));
        annotatedType.setAnnotatedType(builder.create());
    }

public class Test extends BaseTest {

    private static final long serialVersionUID = 6287613662143954294L;

    @Inject
    private Service service;
}




--
View this message in context: http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/ProcessAnnotatedType-with-EJB-deltaspike-cdictrl-openejb-lite-tp4655019.html
Sent from the Apache DeltaSpike Incubator Discussions mailing list archive at Nabble.com.

Re: AW: ProcessAnnotatedType with EJB (deltaspike-cdictrl, openejb-lite)

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Should be
Le 12 mai 2013 20:43, "cchet" <t....@curecomp.com> a écrit :

> Thanks
>
> I will give it a try.
>
> Is this issue fixed in open-ejb-lite-4.6.0 ?
>
> https://issues.apache.org/jira/browse/OWB-803
>
>
>
>
>
> Mit freundlichen Grüßen
>
>
>
> Thomas Herzog
>
> Softwareentwicklung
>
>
>
> curecomp Software Services GmbH
>
> Hafenstrasse 47-51
>
> 4020 Linz
>
>
>
> web: www.curecomp.com <http://www.curecomp.com/>
>
> e-Mail: t.herzog@curecomp.com
>
> tel: +43 (0)732 9015-5563
>
> mobile: +43 (0)664 8867 9829
>
>
>
>
>
>
>
>
>
> Von: Romain Manni-Bucau [via Apache DeltaSpike Incubator Discussions]
> [mailto:ml-node+s2316169n4655020h20@n4.nabble.com]
> Gesendet: Sonntag, 12. Mai 2013 20:36
> An: Thomas Herzog
> Betreff: Re: ProcessAnnotatedType with EJB (deltaspike-cdictrl,
> openejb-lite)
>
>
>
> Hi
>
> Can you try out snapshot please (4.6.0), we had issues on it some versions
> ago and not sure which one got the fix (if done)
> Le 12 mai 2013 20:20, "cchet" <[hidden email]> a écrit :
>
>
> > I have written a cdi extension which should add a @Transactional
> annotation
> > to our @EjbService annotation which is a Stereotype and bundles all
> > annotations which are needed by our EJB Services.
> > I want to annotate it because for our JUnit tests so that we do not have
> to
> > wrap the service invocations in a TransactionalService which rpovides the
> > transaction.
> >
> > The problem is that the TransactionalInterceptor (@Transactional) is not
> > taking place.
> > When I annotate a CDI bean (non EJB) then it works fine.
> > I assume that the problem is that the openEjb container has already
> loaded
> > the EJBs.
> >
> > Is there a restirction i do not know ?
> > Is there a way to get the interceptor to be invoked ?
> > Is it possible to add the inteceptor the proxy via cdi extension ?
> >
> >
> > deltaspike-cdictrl-openejb-0.3-incubating.jar
> > openejb-lite-4.5.0.jar
> >
> > @Inherited
> > @TransactionManagement(TransactionManagementType.CONTAINER)
> > @TransactionAttribute(TransactionAttributeType.REQUIRED)
> > @TransactionAware
> > @Stereotype
> > @Logging
> > @ExceptionWrapping({
> >         @ExceptionWrap(
> >                 wrapper = ConcurrentEntityUpdateException.class,
> >                 sources = OptimisticLockException.class),
> >         @ExceptionWrap(
> >                 wrapper = CoreException.class) })
> > @Retention(RetentionPolicy.RUNTIME)
> > @Target(ElementType.TYPE)
> > public @interface EjbService {
> > }
> >
> > @InterceptorBinding
> > @Target({
> >         TYPE,
> >         METHOD })
> > @Retention(RUNTIME)
> > @Documented
> > public @interface Transactional {
> > }
> >
> >  public void handleEjbServiceannotation(@Observes
> > ProcessAnnotatedType<EjbService> annotatedType) {
> >         AnnotatedTypeBuilder<EjbService> builder = new
> > AnnotatedTypeBuilder<EjbService>();
> >         builder.readFromType(annotatedType.getAnnotatedType());
> >
> > builder.addToClass(AnnotationInstanceProvider.of(Transactional.class));
> >         annotatedType.setAnnotatedType(builder.create());
> >     }
> >
> > public class Test extends BaseTest {
> >
> >     private static final long serialVersionUID = 6287613662143954294L;
> >
> >     @Inject
> >     private Service service;
> > }
> >
> >
> >
> >
> > --
> > View this message in context:
> >
> http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/ProcessAnnotatedType-with-EJB-deltaspike-cdictrl-openejb-lite-tp4655019.html
> > Sent from the Apache DeltaSpike Incubator Discussions mailing list
> archive
> > at Nabble.com.
> >
>
>
>
> ________________________________
>
> If you reply to this email, your message will be added to the discussion
> below:
>
>
> http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/ProcessAnnotatedType-with-EJB-deltaspike-cdictrl-openejb-lite-tp4655019p4655020.html
>
> To unsubscribe from ProcessAnnotatedType with EJB (deltaspike-cdictrl,
> openejb-lite), click here <
> http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4655019&code=dC5oZXJ6b2dAY3VyZWNvbXAuY29tfDQ2NTUwMTl8MTAwMzQ2ODQ2MA==>
> .
> NAML <
> http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
>
>
>
> image001.jpg (3K) <
> http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/attachment/4655021/0/image001.jpg
> >
>
>
>
>
> --
> View this message in context:
> http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/ProcessAnnotatedType-with-EJB-deltaspike-cdictrl-openejb-lite-tp4655019p4655021.html
> Sent from the Apache DeltaSpike Incubator Discussions mailing list archive
> at Nabble.com.
>

AW: ProcessAnnotatedType with EJB (deltaspike-cdictrl, openejb-lite)

Posted by cchet <t....@curecomp.com>.
Thanks

I will give it a try.

Is this issue fixed in open-ejb-lite-4.6.0 ? 

https://issues.apache.org/jira/browse/OWB-803

 

 

Mit freundlichen Grüßen

 

Thomas Herzog

Softwareentwicklung

 

curecomp Software Services GmbH

Hafenstrasse 47-51

4020 Linz

 

web: www.curecomp.com <http://www.curecomp.com/> 

e-Mail: t.herzog@curecomp.com

tel: +43 (0)732 9015-5563

mobile: +43 (0)664 8867 9829

 

 

 

 

Von: Romain Manni-Bucau [via Apache DeltaSpike Incubator Discussions] [mailto:ml-node+s2316169n4655020h20@n4.nabble.com] 
Gesendet: Sonntag, 12. Mai 2013 20:36
An: Thomas Herzog
Betreff: Re: ProcessAnnotatedType with EJB (deltaspike-cdictrl, openejb-lite)

 

Hi 

Can you try out snapshot please (4.6.0), we had issues on it some versions 
ago and not sure which one got the fix (if done) 
Le 12 mai 2013 20:20, "cchet" <[hidden email]> a écrit : 


> I have written a cdi extension which should add a @Transactional annotation 
> to our @EjbService annotation which is a Stereotype and bundles all 
> annotations which are needed by our EJB Services. 
> I want to annotate it because for our JUnit tests so that we do not have to 
> wrap the service invocations in a TransactionalService which rpovides the 
> transaction. 
> 
> The problem is that the TransactionalInterceptor (@Transactional) is not 
> taking place. 
> When I annotate a CDI bean (non EJB) then it works fine. 
> I assume that the problem is that the openEjb container has already loaded 
> the EJBs. 
> 
> Is there a restirction i do not know ? 
> Is there a way to get the interceptor to be invoked ? 
> Is it possible to add the inteceptor the proxy via cdi extension ? 
> 
> 
> deltaspike-cdictrl-openejb-0.3-incubating.jar 
> openejb-lite-4.5.0.jar 
> 
> @Inherited 
> @TransactionManagement(TransactionManagementType.CONTAINER) 
> @TransactionAttribute(TransactionAttributeType.REQUIRED) 
> @TransactionAware 
> @Stereotype 
> @Logging 
> @ExceptionWrapping({ 
>         @ExceptionWrap( 
>                 wrapper = ConcurrentEntityUpdateException.class, 
>                 sources = OptimisticLockException.class), 
>         @ExceptionWrap( 
>                 wrapper = CoreException.class) }) 
> @Retention(RetentionPolicy.RUNTIME) 
> @Target(ElementType.TYPE) 
> public @interface EjbService { 
> } 
> 
> @InterceptorBinding 
> @Target({ 
>         TYPE, 
>         METHOD }) 
> @Retention(RUNTIME) 
> @Documented 
> public @interface Transactional { 
> } 
> 
>  public void handleEjbServiceannotation(@Observes 
> ProcessAnnotatedType<EjbService> annotatedType) { 
>         AnnotatedTypeBuilder<EjbService> builder = new 
> AnnotatedTypeBuilder<EjbService>(); 
>         builder.readFromType(annotatedType.getAnnotatedType()); 
> 
> builder.addToClass(AnnotationInstanceProvider.of(Transactional.class)); 
>         annotatedType.setAnnotatedType(builder.create()); 
>     } 
> 
> public class Test extends BaseTest { 
> 
>     private static final long serialVersionUID = 6287613662143954294L; 
> 
>     @Inject 
>     private Service service; 
> } 
> 
> 
> 
> 
> -- 
> View this message in context: 
> http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/ProcessAnnotatedType-with-EJB-deltaspike-cdictrl-openejb-lite-tp4655019.html
> Sent from the Apache DeltaSpike Incubator Discussions mailing list archive 
> at Nabble.com. 
> 

 

________________________________

If you reply to this email, your message will be added to the discussion below:

http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/ProcessAnnotatedType-with-EJB-deltaspike-cdictrl-openejb-lite-tp4655019p4655020.html 

To unsubscribe from ProcessAnnotatedType with EJB (deltaspike-cdictrl, openejb-lite), click here <http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4655019&code=dC5oZXJ6b2dAY3VyZWNvbXAuY29tfDQ2NTUwMTl8MTAwMzQ2ODQ2MA==> .
NAML <http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>  



image001.jpg (3K) <http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/attachment/4655021/0/image001.jpg>




--
View this message in context: http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/ProcessAnnotatedType-with-EJB-deltaspike-cdictrl-openejb-lite-tp4655019p4655021.html
Sent from the Apache DeltaSpike Incubator Discussions mailing list archive at Nabble.com.

Re: ProcessAnnotatedType with EJB (deltaspike-cdictrl, openejb-lite)

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

Can you try out snapshot please (4.6.0), we had issues on it some versions
ago and not sure which one got the fix (if done)
Le 12 mai 2013 20:20, "cchet" <t....@curecomp.com> a écrit :

> I have written a cdi extension which should add a @Transactional annotation
> to our @EjbService annotation which is a Stereotype and bundles all
> annotations which are needed by our EJB Services.
> I want to annotate it because for our JUnit tests so that we do not have to
> wrap the service invocations in a TransactionalService which rpovides the
> transaction.
>
> The problem is that the TransactionalInterceptor (@Transactional) is not
> taking place.
> When I annotate a CDI bean (non EJB) then it works fine.
> I assume that the problem is that the openEjb container has already loaded
> the EJBs.
>
> Is there a restirction i do not know ?
> Is there a way to get the interceptor to be invoked ?
> Is it possible to add the inteceptor the proxy via cdi extension ?
>
>
> deltaspike-cdictrl-openejb-0.3-incubating.jar
> openejb-lite-4.5.0.jar
>
> @Inherited
> @TransactionManagement(TransactionManagementType.CONTAINER)
> @TransactionAttribute(TransactionAttributeType.REQUIRED)
> @TransactionAware
> @Stereotype
> @Logging
> @ExceptionWrapping({
>         @ExceptionWrap(
>                 wrapper = ConcurrentEntityUpdateException.class,
>                 sources = OptimisticLockException.class),
>         @ExceptionWrap(
>                 wrapper = CoreException.class) })
> @Retention(RetentionPolicy.RUNTIME)
> @Target(ElementType.TYPE)
> public @interface EjbService {
> }
>
> @InterceptorBinding
> @Target({
>         TYPE,
>         METHOD })
> @Retention(RUNTIME)
> @Documented
> public @interface Transactional {
> }
>
>  public void handleEjbServiceannotation(@Observes
> ProcessAnnotatedType<EjbService> annotatedType) {
>         AnnotatedTypeBuilder<EjbService> builder = new
> AnnotatedTypeBuilder<EjbService>();
>         builder.readFromType(annotatedType.getAnnotatedType());
>
> builder.addToClass(AnnotationInstanceProvider.of(Transactional.class));
>         annotatedType.setAnnotatedType(builder.create());
>     }
>
> public class Test extends BaseTest {
>
>     private static final long serialVersionUID = 6287613662143954294L;
>
>     @Inject
>     private Service service;
> }
>
>
>
>
> --
> View this message in context:
> http://apache-deltaspike-incubator-discussions.2316169.n4.nabble.com/ProcessAnnotatedType-with-EJB-deltaspike-cdictrl-openejb-lite-tp4655019.html
> Sent from the Apache DeltaSpike Incubator Discussions mailing list archive
> at Nabble.com.
>