4 Replies Latest reply on Apr 13, 2007 7:50 PM by shane.bryzak

    Can't remote to session bean instance in server initiated co

    johnechesher

      I have a stateful session bean in conversation scope and reach a page that is within that conversation/scope. from that page, I make a remote call to the bean, but it is getting a new instance of the bean. Before the remote call, if I make a remote call to get the conversation ID, it is null. After the remote call (I unclick the checkbox below to execute the remote call a 2nd time) if I make a remote call to get the conversation ID, it is one more than the long running conversation ID that is still active on the server. Is there no way to "join/utilize" the existing conversation using Seam remoting? The ref doc discusses conversations and remoting and I've seen posts regarding it, but the posts involve starting, using and ending the conversation all through remote access, not accessing a bean in a conversation that already exists...
      Thanks!

      Here are my code snippets:

      ...
      @Stateful
      @Name("maintainUsers")
      @Restrict("#{identity.loggedIn and s:hasPermission('userAndInstitution','create', null)}")
      public class MaintainUsersAction implements MaintainUsers {
      ...
       public void addOneFamilyInst(Long id, boolean checked){
       if (checked) {
       System.out.println("Checked Inst");
       }
       else {
       System.out.println("Unchecked Inst");
       }
       return;
       }
      ...




      <input type="checkbox" onclick="addFamily(#{i.id}, this.checked);"/>
      ...
      <script type="text/javascript">
       function addFamily(instId, checked)
       {
       cid = Seam.Remoting.getContext().getConversationId();
       alert('Conversation id: ' + cid);
       Seam.Remoting.getContext().setConversationId(cid);
      
       var remoteManager = Seam.Component.getInstance('maintainUsers');
       Seam.Remoting.startBatch();
       remoteManager.addOneFamilyInst(instId, checked);
       Seam.Remoting.executeBatch();
      
       }
      </script>