2 Replies Latest reply on Jul 24, 2007 10:57 AM by wise_guybg

    jboss seam bijection problem

    talekar

      jboss seam 1.2.1

      I am having trouble understanding how bijection work with jbpm. Here is a simple jpdl:

      <process-definition name="MyWorkflow">
      
       <start-state name="start">
       <transition to="decide"></transition>
       </start-state>
      
       <decision name="decide" expression="#{myManager.result}">
       <transition to="assigntask" name="assigntask"></transition>
       <transition to="end" name="end"></transition>
       </decision>
      
       <task-node name="assigntask">
       <task name="Evaluate">
       <assignment actor-id="adminuser"></assignment>
       </task>
       <transition to="end" name="cancel"></transition>
       <transition to="decide" name="retry"></transition>
       </task-node>
      
       <end-state name="end"></end-state>
      
      </process-definition>
      


      Notice that the decision task calls #{myManager.decide} which a SFSB:
      @Stateful
      @Name ("myManager")
      public class MyManagerImpl implements MyManager,
       Serializable {
      
       private static final long serialVersionUID = 1L;
      
       @Logger
       private Log LOG;
      
       @PersistenceContext (type = PersistenceContextType.EXTENDED)
       private EntityManager entityManager;
      
       @In (required = false)
       @Out (scope = BUSINESS_PROCESS, required = true)
       private Long id;
      
       @CreateProcess(definition = "MyWorkflow")
       public void begin() {
       id = new Long(10);
       }
      
       public String getResult() {
       // NPE :-(
       // why doesnt id get injected?
       int x = id.intValue();
       }
      
       @Remove
       @Destroy
       public void destroy() {
       }
      }
      


      I get a NPE in getResult() when it is called by jBPM. How come id never gets injected back?

      I set logging to TRACE on org.jboss.seam.Component and I get the "injecting dependencies of" message when begin() is called. But I DONT see the same messages when the jBPM task node executes the getResult() expression.

      Am I missing something in a config file?

      Thanks in advance.

        • 1. Re: jboss seam bijection problem
          talekar

          please help, i have been struggling with this for 3 days now. thanks

          • 2. Re: jboss seam bijection problem
            wise_guybg

            Hi,

             @In (required = false)
             @Out (scope = BUSINESS_PROCESS, required = true)
             private Long id;
            


            Doesn't @In have to use the scope = BUSINESS_PROCESS?

            There is an example in the book "JBoss Seam - Simplicity and Power Beyond Java EE". There must be examples on the Internet and with Seam too. Have you double-checked against the source you're using?