[jboss-user] [jBPM] - Re: rule.ConsequenceException only with JPA

Gary Struthers do-not-reply at jboss.com
Wed Aug 10 16:03:51 EDT 2011

Gary Struthers [http://community.jboss.org/people/GaryS] created the discussion

"Re: rule.ConsequenceException only with JPA"

To view the discussion, visit: http://community.jboss.org/message/620458#620458

I made the problem go away but I don't understand why. I have a rule that updates a field in a process variable pojo.
rule "applicationReady"
    ruleflow-group "assignApplication"
        $process: WorkflowProcessInstance();
        $vars :PIvars() from (PIvars)$process.getVariable("vars");
eval($vars.getAppId() == 0);
    System.out.println("!!Begin firing rule applicationReady " + $vars);
#       $process.setVariable("vars", $vars);
    System.out.println("!!End firing rule applicationReady"  + $vars);

Commenting out $process.setVariable("vars", $vars); works with both JPA and without. My pojo is inserted as a Fact. Salaboy's example 
rule "New Ambulance for Heart Attack Emergencies"
    ruleflow-group "select_vehicle"
        $process: WorkflowProcessInstance()
        Emergency(type == "Heart Attack") from $process.getVariable("emergency")

        System.out.println("A new Ambuance is being created!");
        Ambulance ambulance = new Ambulance("MyAmbulance");
        ((WorkflowProcessInstance)kcontext.getKnowledgeRuntime().getProcessInstance($process.getId())).setVariable("vehicle", ambulance);
Creates a new pojo, where mine just sets a field variable and in my case I'm not sure what is the reliable way to do it.

Reply to this message by going to Community

Start a new discussion in jBPM at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110810/d1428e30/attachment-0001.html 

More information about the jboss-user mailing list