1 2 Previous Next 20 Replies Latest reply on Apr 9, 2008 5:23 PM by darthmaul Go to original post
      • 15. Re: Interception on JavaBeans Not Working
        christian.bauer

        There is no reason why the Seam container couldn't use the same annotation. And indeed it does.

        • 16. Re: Interception on JavaBeans Not Working
          gjeudy

          Thanks Christian, I should be more pragmatic, yes indeed these javax.interceptors. classes can be used anywhere they are just annotations/interfaces afterall.


          But as far as contracts go, if an javax.interceptor annotation is used should we expect the class using the annotation be an EJB3 spec compliant component ? example: session bean. I would think so.


          However i'm not sure about the container end of the spec. Should only EJB3 compliant containers read/process these javax.interceptor annotations ? I guess this is a gray zone, I would have to check what Seam is doing with these.

          • 17. Re: Interception on JavaBeans Not Working
            christian.bauer

            Guillaume Jeudy wrote on Apr 08, 2008 11:14 PM:


            But as far as contracts go, if an javax.interceptor annotation is used should we expect the class using the annotation be an EJB3 spec compliant component ? example: session bean. I would think so.



            Who cares, it's metadata and whoever wants can read it and do something with that. It's certainly not an EJB 3.0 session bean component, because that would require some more metadata.



            However i'm not sure about the container end of the spec. Should only EJB3 compliant containers read/process these javax.interceptor annotations ? I guess this is a gray zone, I would have to check what Seam is doing with these.


            Again, who cares, there is no technical reason to categorize things like that.


            • 18. Re: Interception on JavaBeans Not Working
              darthmaul

              Well, I thought about it some more, and I decided that the interceptor approach probably wasn't ideal for what I was trying to accomplish.


              However, I know I will need to use this capability in the future for other kinds of exception handling and for logging among other things, so I will still need to know how to make interception work in the future.  Any idea why changing things to @Target(TYPE) didn't help?  Are there any tips and tricks to consider when trying to use the interceptor capability on JavaBeans outside of en EJB3 environment?


              Thanks again.

              • 19. Re: Interception on JavaBeans Not Working
                gjeudy

                Christian you are right, there is no technical reasons to categorize things like that. I was just thinking about the contractual concerns of using javax.interceptor package.


                Anyways to return the main purpose of this thread, Neil have you tried declaring your annotation at the class level(Combined with @Target(TYPE) change)? Let me know if that works.



                
                @Name("queryService")
                
                @NoSuchWidget
                
                public class QueryService extends Object {
                
                   @In
                
                   EntityManager em;
                
                   @Logger
                
                   protected Log logger;
                
                
                   
                
                   public Widget findWidgetByNumber(String number) {
                
                      return(Widget) em.createNamedQuery("findWidgetByNumber").setParameter("number", number).getSingleResult();
                
                }
                
                


                • 20. Re: Interception on JavaBeans Not Working
                  darthmaul

                  Sadly, that didn't work.  I have no idea why.  Somehow, Seam isn't getting that this interceptor needs to do its thing. 


                  At this point, this has become more of an academic curiosity since I decided that a different route was superior anyway.  But I will need to do this in the future, and I am sure I will be back again with a similar question.


                  Thanks for your help.

                  1 2 Previous Next