Hi Frank,<br><br>It&#39;s good to have feedback :)<br><br>Closing the loop will help others who Google for similar issues at some future date.<br><br>At least you no longer have to stare at your code getting bored!<br><br>
With kind regards,<br><br>Mike<br><br><div class="gmail_quote">On 8 March 2011 11:31, 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;">
I know etiquette stipulates to avoid small talk, but since there is no<br>
&quot;resolved&quot; button, I think this can be useful.<br>
<br>
You suspected rightly, manstis, removing lock-on-active and replacing it<br>
with extra constraints in the LHS indeed solved the problem.<br>
<br>
Thanks for the quick (and correct) response :-).<br>
<div class="im"><br>
<br>
manstis wrote:<br>
&gt;<br>
&gt; I suspect your use of lock-on-active.<br>
&gt;<br>
&gt; Expert&#39;s documentation states: &quot;Whenever ... an agenda-group receives the<br>
&gt; focus, any rule within that group that has lock-on-active set to true will<br>
&gt; not be activated any more; irrespective of the origin of the update, the<br>
&gt; activation of a matching rule is discarded&quot;. Both rules are in the default<br>
&gt; MAIN agenda group so when the first inserts a new Price the update to WM<br>
&gt; (insert in your case) is not visible to the other rule. Inserting a new<br>
&gt; Price before calling fireAllRules or commenting out the price constraint<br>
&gt; in<br>
&gt; the LHS alters the Facts\Patterns needing to be matched for activation to<br>
&gt; occur.<br>
&gt;<br>
&gt; So, try removing lock-on-active (or making the two rules in different<br>
&gt; agenda<br>
&gt; groups).<br>
&gt;<br>
&gt; With kind regards,<br>
&gt;<br>
&gt; Mike<br>
&gt;<br>
</div><div><div></div><div class="h5">&gt; On 8 March 2011 09:53, FrankVhh  wrote:<br>
&gt;<br>
&gt;&gt; Hi all,<br>
&gt;&gt;<br>
&gt;&gt; Since yesterday, I am having a problem with reading inserted objects from<br>
&gt;&gt; memory. I don&#39;t know why it does not go as planned, because it should be<br>
&gt;&gt; quite straightforward. It is getting boring to stare at the code, so<br>
&gt;&gt; maybe<br>
&gt;&gt; one of you can detect an error.<br>
&gt;&gt;<br>
&gt;&gt; There are 2 kinds of rules. One kind inserts price objects into working<br>
&gt;&gt; memory (as in example 1). THe other kind detects whether the price exists<br>
&gt;&gt; and adapts it to a product (as in example 2).<br>
&gt;&gt;<br>
&gt;&gt; Example 1 seems to work, but the engine does not seem to recognize them<br>
&gt;&gt; as<br>
&gt;&gt; a<br>
&gt;&gt; Price object. All original price attributes of the products remain<br>
&gt;&gt; unchanged<br>
&gt;&gt; unless:<br>
&gt;&gt;   - I manually insert a Prce object before calling fireAllRules()<br>
&gt;&gt;   or<br>
&gt;&gt;   - Checking for an existing price is commented out in the LHS<br>
&gt;&gt;<br>
&gt;&gt; Removing constraints from $price (just checking for existance of a price)<br>
&gt;&gt; does not help.<br>
&gt;&gt;<br>
&gt;&gt; Any idea what has been going wrong?<br>
&gt;&gt;<br>
&gt;&gt; Thanks in advance.<br>
&gt;&gt;<br>
&gt;&gt; ==============Example 1=================<br>
&gt;&gt; rule &quot;Prices_17&quot;<br>
&gt;&gt;<br>
&gt;&gt;        lock-on-active true<br>
&gt;&gt;        when<br>
&gt;&gt;        then<br>
&gt;&gt;                Price $price = new Price();<br>
&gt;&gt;                $price.setName(&quot;Blue autumn&quot;);<br>
&gt;&gt;                $price.setPrice(6);<br>
&gt;&gt;                insert($price);<br>
&gt;&gt;                System.out.println(&quot;Price &quot; + $price.getName() + &quot;<br>
&gt;&gt; inserted&quot;);<br>
&gt;&gt; end<br>
&gt;&gt; =============Example of usage=========================<br>
&gt;&gt;<br>
&gt;&gt; rule &quot;Products_36&quot;<br>
&gt;&gt;<br>
&gt;&gt;        lock-on-active true<br>
&gt;&gt;        when<br>
&gt;&gt;                $product: Product(colour == &quot;Blue&quot;)<br>
&gt;&gt;                Season(season == Season.AUTUMN)<br>
&gt;&gt;                $price: Price(name == &quot;Blue autumn&quot;)<br>
&gt;&gt;        then<br>
&gt;&gt;                $product.setPrice($price.getPrice());<br>
&gt;&gt;                update($product);<br>
&gt;&gt;                System.out.println(&quot;Rule executed&quot;);<br>
&gt;&gt; end<br>
&gt;&gt; ===================================================<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; View this message in context:<br>
&gt;&gt; <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>

&gt;&gt; Sent from the Drools - User mailing list archive at Nabble.com.<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; rules-users mailing list<br>
&gt;&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;<br>
<br>
<br>
--<br>
</div></div>View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Object-insertion-on-runtime-tp2650219p2650454.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/Object-insertion-on-runtime-tp2650219p2650454.html</a><br>

<div><div></div><div class="h5">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>
</div></div></blockquote></div><br>