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&...]