9 Replies Latest reply on Feb 15, 2008 9:59 AM by mars1412

    Conversation @Begin(join=true) not working properly?

    mirko27

      My goals:
      Implement smth, as MessageList but the "message" is carried to next page for editing.

      The way I did it:

      @Stateful
      @Name("usersList")
      @Interceptors(SeamInterceptor.class)
      @Conversational(ifNotBegunOutcome="main")
      
      public class UsersListBean implements UsersList
      {
       @DataModel
       private List<PortalUser> users;
      
       @Out(required=false)
       @DataModelSelection
       private PortalUser current;
      
       @PersistenceContext(type=EXTENDED)
       private EntityManager em;
      
       @Factory("users")
       public String findUsers(){
       users = (List<PortalUser>) em.createQuery("from PortalUser u order by surname,firstname asc").getResultList();
       return "";
       }
       @Begin(join=true)
       public String select() {
      
       return "user"; // goto user page to edit user
       }
       @End
       public String done() {
       return "users"; // back to users page, this works fine
       }
       @Remove @Destroy
       public void destroy() {}
      }
      


      Problems:
      It works fine when user uses action usersList.done button.
      But what about when he leaves this page some other way? Maybe
      goes to users page by a outputLink and then selects new user to edit?
      Then old conversation is still being in memory, and a new one is created.
      Doesn`t Seam have to join that old conversation? Or does outputLink kill the JSF state?

      Anyway, how to solve this problem, it would be nice to have a good solution for it.