[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"
when
$process: WorkflowProcessInstance();
$vars :PIvars() from (PIvars)$process.getVariable("vars");
eval($vars.getAppId() == 0);
then
System.out.println("!!Begin firing rule applicationReady " + $vars);
$vars.setApplicationReady(true);
# $process.setVariable("vars", $vars);
System.out.println("!!End firing rule applicationReady" + $vars);
end
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"
when
$process: WorkflowProcessInstance()
Emergency(type == "Heart Attack") from $process.getVariable("emergency")
then
System.out.println("A new Ambuance is being created!");
Ambulance ambulance = new Ambulance("MyAmbulance");
((WorkflowProcessInstance)kcontext.getKnowledgeRuntime().getProcessInstance($process.getId())).setVariable("vehicle", ambulance);
insert(ambulance);
end
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
[http://community.jboss.org/message/620458#620458]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
-------------- 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