2 Replies Latest reply on Jul 2, 2007 8:04 AM by Stefano Zaccaria

    @CreateProcess and process id

    Stefano Zaccaria Newbie

      Hello to all, somebody know how retriew the ProcessId after to have create a process with @CreateProcess annotation?
      Es.:

      @CreateProcess(definition="processName")
      public void parse()
      {
       //get processID and make something with...
       ...
       ...
      }
      


        • 1. Re: @CreateProcess and process id
          Pete Muir Master

          The process isn't created until after the method completes so during the method the processId isn't available.

          • 2. Re: @CreateProcess and process id
            Stefano Zaccaria Newbie

             

            "pete.muir@jboss.org" wrote:
            The process isn't created until after the method completes so during the method the processId isn't available.

            Any workaround idea for this? I must to retriew the processid from the db throught a variable that put in the context like dvd example of seam
            ...
            public String cancelOrder() {
            
             em.refresh(order);
            
             if ( order.getStatus() != Status.OPEN ) {
             return null;
             }
            
             order.setStatus(Status.CANCELLED);
            
             JbpmContext context = ManagedJbpmContext.instance();
            
             ProcessInstance pi = (ProcessInstance) context.getSession()
             .createQuery("select pi from LongInstance si join si.processInstance pi " +
             "where si.name = 'orderId' and si.value = :orderId")
             .setLong("orderId", order.getOrderId())
             .uniqueResult();
            
             pi.signal("cancel");
            
             context.save(pi);
            
             return findOrders();
             }
            ...
            

            that i found in the ShowOrdersAction class?