<div>I just upgraded to Drools 4.0 and changed my assertObject calls to insert. I also switched from WorkingMemory to StatefulSession. The rules seem to be fine, but I am not able to retrieve any inserted objects from the working memory for some reason. Here is what I'm doing. I'd appreciate any suggestions...
</div>
<div><font size="2">
<p align="left">StatefulSession <strong>workingMemory</strong> = getActiveWorkingMemories(id);<br><strong>workingMemory</strong>.fireAllRules();</p>
<p>// Here is the rule that fires:</p><b><font color="#960000" size="2">
<p align="left">rule</p></font></b></font><font size="2"> </font><font color="#008000" size="2">"RecognizeBenefitsProgramEvent"</font><font size="2"> <strong><br></strong></font><b><font color="#960000" size="2">
when</font></b><font size="2"> $edit: BenefitsProgramModelEdit() <br></font><b><font color="#960000" size="2"> then</font></b><font size="2"> <br></font><b><font color="#960000" size="2"> insert</font></b><font size="2">
(</font><b><font color="#960000" size="2">new</font></b><font size="2"> <strong>BenefitsProgramEvent</strong>(</font><font color="#008000" size="2">"BenefitsProgramEvent"</font><font size="2">, $edit.getValidFrom(),
</font><font color="#008000" size="2">"AnnualEnrollmentEvent"</font><font size="2">)); <strong><br></strong><strong> System</strong>.out.println(</font><font color="#008000" size="2">"Rule RecognizeBenefitsProgramEvent fired "
</font><font size="2">); <strong><br></strong></font><b><font color="#960000" size="2">end</font></b><br><br>I see the print statement in the console but the inserted object is not actually in the working memory. I look using this:
<br><br>Iterator events = <strong>workingMemory</strong>.iterateObjects(new ClassObjectFilter(BenefitsProgramEvent.class));
<p align="left">This iterator is empty. I also debug and look at the assetMap inside workingMemory and it never changes.</p>
<p align="left">Thanks,</p>
<p align="left">Michael</p></div>