1 Reply Latest reply on Aug 28, 2009 1:26 AM by swd847

    How does Seam know when to apply bijection on which components

    asookazian

      So apparently Seam does not biject any instances in entity classes, even if they are marked using @Name.  Which class/method(s) in the Seam core codebase is responsible for the bijection and determining what type of class/component it is so it knows whether bijection is legal or not?


      I guessed org.jboss.seam.core.BijectionInterceptor but not sure if that's the right one...


      Also, in the API for that class, there's this public method: isInterceptorEnabled().


      How exactly would you use this in a Seam component?


      You can't inject BijectionInterceptor, b/c it doesn't have @Name (i.e. it's not a Seam component).


      So would you just do:


      BijectionInterceptor bijectionInterceptor = new BijectionInterceptor();
      boolean myVal = bijectionInterceptor.isInterceptorEnabled();



      ???


      that doesn't seem right...


      that method is from OptimizedInterceptor interface which is implemented by BijectionInterceptor:


      Returns true if this interceptor should be enabled. The component and the annotation will be injected into the interceptor instance before this method is called, and can be used to decide whether the interceptor should be enabled


      So should we expect the return value to be true for session beans and JavaBeans, and false if invoked from an entity class method?

        • 1. Re: How does Seam know when to apply bijection on which components
          swd847

          Seam cannot apply interceptors to entities as they are created by hibernate (or toplink or whatever). This is why interception, transaction management etc does not work (as seam does not have a chance to proxy the entity, and even if it could it would kill performance).


          BijectionInterceptor is a default interceptor, it gets applied automatically.


          All components created by seam a legal targets, unless is has been marked @Bypassinterceptors.