0 Replies Latest reply on Jun 28, 2007 5:51 PM by Hung Tang

    Seam 2.0.0Beta1 and nested conversations

    Hung Tang Apprentice

      I just upgraded to Seam 2.0.0B1 and my app that deals with nested conversations is broken. It was working with 1.3.0A.

      Scenario:
      --
      I have a web page w1, that links to another web page w2. Getting to w1 will start a long-running conversation c1. Getting to w2 from w1 will start a nested conversation c2. w1 uses Seam's EntityHome to load and edit a particular entity e1 given its id. w2 does the same thing as w1 but for another entity e2.

      Problem after upgrading:
      --
      w2 does not load e2 any more

      Investigation:
      --
      When loading w2, I verified the entity home's setId() is being called, and that the instance is set to null, which is expected since it'll prepare for retrieving a new instance from DB the next time getInstance() is called. However, I'm finding that when getInstance() is called, the instance is, for some reason, not null anymore so e2 will not be loaded. I'm stuck here.

      Would appreciate if anyone have any insight to this problem. Below is a contrived example to demonstrate this:


      ## components.xml

       <factory name="department" value="#{departmentHome.instance}" auto-create="true"/>
       <fwk:entity-home name="departmentHome" entity-class="com.mxnmedia.siteaudit.glue.Department"/>
      
       <factory name="employee" value="#{employeeHome.instance}" auto-create="true"/>
       <fwk:entity-home name="employeeHome" entity-class="com.mxnmedia.siteaudit.glue.Employee"/>
      


      ## Employee.java (e1), Department.java (e2)
      @Entity
      public class Department {
       @Id
       private Long id;
       private String name;
      }
      
      @Entity
      public class Employee {
       @Id
       private Long id;
       @OneToOne
       @JoinColumn(name = "departmentid")
       private Department department;
       private String name;
      }
      


      # employee.page.xml
       <begin-conversation join="true"/>
       <param name="id" value="#{employeeHome.id}" converterId="javax.faces.Long"/>
      
       <!-- THIS LINE MUST BE HERE; IF TAKEN OUT, IT WORKS!! -->
       <action execute="#{employeeHome.id}" if="#{departmentHome.managed}"/>
      


      ## employee.xhtml (w1)
       <!-- THIS APPEARS FINE -->
       <h:outputText value="#{employee.name}"/>
      
      <s:link view="/department.xhtml" value="Go w2" propagation="nest">
       <f:param name="id" value="1"/>
       </s:link>
      
      


      # department.page.xml
       <begin-conversation join="true"/>
       <param name="id" value="#{departmentHome.id}" converterId="javax.faces.Long"/>
      


      ## department.xhtml (w2)
      <!-- DOES NOT SHOW ANYTHING ANYMORE -->
      <h:outputText value="#{department.name}"/>
      


      w2 loads fine if you do "http://localhost:8080/myapp/department.seam?id=1"

      but it won't load if you go from w1 to w2 where w1 is called by
      "http://localhost:8080/myapp/employee.seam?id=1"