I suspect your use of lock-on-active.<br><br>Expert&#39;s documentation states: &quot;Whenever ... an agenda-group receives the focus, any rule within that group that has lock-on-active set to true will not be activated any more; irrespective of the origin of the update, the activation of a matching rule is discarded&quot;. Both rules are in the default MAIN agenda group so when the first inserts a new Price the update to WM (insert in your case) is not visible to the other rule. Inserting a new Price before calling fireAllRules or commenting out the price constraint in the LHS alters the Facts\Patterns needing to be matched for activation to occur.<br>
<br>So, try removing lock-on-active (or making the two rules in different agenda groups).<br><br>With kind regards,<br><br>Mike<br><br><div class="gmail_quote">On 8 March 2011 09:53, FrankVhh <span dir="ltr">&lt;<a href="mailto:frank.vanhoenshoven@agserv.eu">frank.vanhoenshoven@agserv.eu</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi all,<br>
<br>
Since yesterday, I am having a problem with reading inserted objects from<br>
memory. I don&#39;t know why it does not go as planned, because it should be<br>
quite straightforward. It is getting boring to stare at the code, so maybe<br>
one of you can detect an error.<br>
<br>
There are 2 kinds of rules. One kind inserts price objects into working<br>
memory (as in example 1). THe other kind detects whether the price exists<br>
and adapts it to a product (as in example 2).<br>
<br>
Example 1 seems to work, but the engine does not seem to recognize them as a<br>
Price object. All original price attributes of the products remain unchanged<br>
unless:<br>
   - I manually insert a Prce object before calling fireAllRules()<br>
   or<br>
   - Checking for an existing price is commented out in the LHS<br>
<br>
Removing constraints from $price (just checking for existance of a price)<br>
does not help.<br>
<br>
Any idea what has been going wrong?<br>
<br>
Thanks in advance.<br>
<br>
==============Example 1=================<br>
rule &quot;Prices_17&quot;<br>
<br>
        lock-on-active true<br>
        when<br>
        then<br>
                Price $price = new Price();<br>
                $price.setName(&quot;Blue autumn&quot;);<br>
                $price.setPrice(6);<br>
                insert($price);<br>
                System.out.println(&quot;Price &quot; + $price.getName() + &quot; inserted&quot;);<br>
end<br>
=============Example of usage=========================<br>
<br>
rule &quot;Products_36&quot;<br>
<br>
        lock-on-active true<br>
        when<br>
                $product: Product(colour == &quot;Blue&quot;)<br>
                Season(season == Season.AUTUMN)<br>
                $price: Price(name == &quot;Blue autumn&quot;)<br>
        then<br>
                $product.setPrice($price.getPrice());<br>
                update($product);<br>
                System.out.println(&quot;Rule executed&quot;);<br>
end<br>
===================================================<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Object-insertion-on-runtime-tp2650219p2650219.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/Object-insertion-on-runtime-tp2650219p2650219.html</a><br>

Sent from the Drools - User mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</font></blockquote></div><br>