<br><br> Hi,<br><br> Please note that java.lang.Integer is an immutable class. So, what is happening when you do:<br><br>unEntier++;<br>update(unEntier);<br><br> is that java is actually doing is creating another, different
java.lang.Integer object (using auto-boxing/unboxing).<br> What you need to do is:<br><br>rule "incrementation"<br> no-loop<br> when<br> unEntier : java.lang.Integer()<br> then
<br> retract( unEntier );<br> unEntier++;<br> System.out.println("incrementation firing...");<br> insert(unEntier);<br>end<br><br><br> []s<br> Edson
<br><br><div><span class="gmail_quote">2007/8/2, hypnosat7 <<a href="mailto:ablarbi@yahoo.fr">ablarbi@yahoo.fr</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>hi I have an exception after using an update<br><br> This is my rule :<br><br>package packageDrlTest<br><br>#list any import classes here.<br>import java.lang.Integer;<br><br><br>#declare any global variables here<br>
<br>rule "incrementation"<br> no-loop<br> when<br> unEntier : java.lang.Integer()<br> then<br> unEntier++;<br> System.out.println("incrementation firing...");
<br> update(unEntier);<br><br>end<br><br><br>when I execute my rule on this list of facts :<br><br>List integerList = new ArrayList();<br>integerList.add(Integer.valueOf(1));<br>for (Object fact : integerList )
<br>{<br> session.insert(fact); // session is a StatefulMemory<br>}<br><br>Update error: handle not found for object: 2. Is it in the working memory?<br><br>détails :<br><br>incrementation firing...<br>org.drools.FactException
: Update error: handle not found for object: 2. Is<br>it in the working memory?<br> at<br>org.drools.base.DefaultKnowledgeHelper.update(DefaultKnowledgeHelper.java:93)<br> at<br>packageDrlTest.Rule_incrementation_0.consequence
(Rule_incrementation_0.java:9)<br> at<br>packageDrlTest.Rule_incrementation_0ConsequenceInvoker.evaluate(Rule_incrementation_0ConsequenceInvoker.java:22)<br> at org.drools.common.DefaultAgenda.fireActivation
(DefaultAgenda.java:545)<br> at org.drools.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:509)<br> at<br>org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:430)<br> at
<br>org.drools.common.AbstractWorkingMemory.fireAllRules(AbstractWorkingMemory.java:392)<br>--<br>View this message in context: <a href="http://www.nabble.com/Update-error%3A-handle-not-found-for-object-tf4206369.html#a11965297">
http://www.nabble.com/Update-error%3A-handle-not-found-for-object-tf4206369.html#a11965297</a><br>Sent from the drools - user mailing list archive at <a href="http://Nabble.com">Nabble.com</a>.<br><br><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">https://lists.jboss.org/mailman/listinfo/rules-users
</a><br></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> Software Engineer - JBoss Rules Core Developer<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646<br> JBoss, a division of Red Hat @
<a href="http://www.jboss.com">www.jboss.com</a>