0 Replies Latest reply on Aug 7, 2009 6:50 PM by Juan Martin Chiaradia

    JavaBeanInterceptor and Object internal state

    Juan Martin Chiaradia Newbie


      I have a session scoped useCaseMannager component that creates useCases and begin/commit/cancel it:

      public class UseCaseMannager {
           private UseCase actualUseCase;
           public void createOutNote() {
                actualUseCase = (UseCase) Component.getInstance("createOutNoteUC");
           private void cancelPreviousUseCase() {
                if(actualUseCase!=null && actualUseCase.isActive()){

      The idea is that if the user is in an active useCase, and he start another useCase, the useCaseMannager will cancel the previous one before starting the new one.

      Each usecase start his own conversation and flus/refresh it:

      public abstract class UseCase implements Serializable {
           private static final long serialVersionUID = -3455097994645434548L;
           private boolean isActive = false;
           protected EntityManager entityManager;
           public String begin() {
                this.isActive = true;
                return Constants.SUCCESS.name();
           public String finish() {
                this.isActive = false;
                return Constants.SUCCESS.name();
           public String cancel() {
                this.isActive = false;
                return Constants.SUCCESS.name();
           public final boolean isActive(){
                return isActive;
           protected void initialize(){};
           protected void preCommit(){};
           protected void postCommit(){};
           protected void preRollback(){};
           protected void postRollback(){};

      The problem I'm having is that the instance variable actualUseCase is not refreshing his internal state (the isActive boolean) when I begin it.
      It seams that Seam add an interceptor handler to this variable:


      I debbug it and I have:

      actualUseCase.handler =  org.jboss.seam.intercept.JavaBeanInterceptor
      actualUseCase.isActive = false
      actualUseCase.handler.bean = createOutNoteUC  //(the actualUseCase)
      actualUseCase.handler.bean.isActive = true

      If I mark my UseCase as @BypassInterceptors, it will not have any handler and works ok, but I can't use the @Begin,@End and @IN/@Out.

      Do you know how I can do this without @BypassInterceptors and why the handler works like this?