2 Replies Latest reply on May 29, 2009 8:41 PM by Arbi Sookazian

    outjection during temp conversation

    Arbi Sookazian Master

      This is a strange (or at least uncommon) scenario I just experienced using Seam 2.0.


      I have two business methods in my SFSB.  One is annotated with @Begin, the other has no annotations.


      Both are invoked by action handlers via HtmlCommandButton components in my facelet/JSF.


      I am outjecting a context variable (siteId) to SESSION scope.


      The strange behavior is that the outjection for the un-annotated method (i.e. temp conversation) for siteId either does not happen or the context variable goes out of scope or is subsequently set to null (possibly because the temp conversation is destroyed by Seam container).


      When I added @Begin(join=true) the new siteId value is available during the subsequent method call (@Injection).


      Here is some code to explain things better:


      @Out(required=false)
      private String techId;
      
      @Begin(join=true)  //this line was originally commented...
           public void changeSiteId() 
           {
                siteId = new Integer(selectedListValueEntityForSiteId.getCode()).shortValue();
                log.info("in changeSiteId(): siteId = "+siteId);
           }
      
      @Begin(join=true)
           @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
           public void searchSerialNumber() 
           {     
                if (siteId == null)
                     getSiteId();
                
                if(validateSerialNumber())
                {
                     loadWorkOrders(siteId);               
                     loadRepairHistory();
                     loadEquipmentDetail(siteId);               
                     header = "Search Equipment";
                     showCreateNew = true;
                }
                else
                {
                     facesMessages.addToControl("serialNumberId", "Serial number " + serialNumber + " does not exist in ICOMS");
                     showCreateNew = false;
                }
           }



      The reason I am confused is b/c the session never timed out or went out of scope.  So why must you have a LRC for @Outjection to work properly?  And does this rule apply to other scopes as well when outjecting?


      The problem is that I really only want the LRC started after searchSerialNumber() is executed, not for the other method as well.  thx.