<br><font size=2 face="sans-serif">OK: If your rules are looping, it suggests
that you may have written them badly. (EG:</font>
<br>
<br><font size=2 face="sans-serif">rule rule1</font>
<br><font size=2 face="sans-serif">when</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; ObjectA
( $property : property==null )</font>
<br><font size=2 face="sans-serif">then </font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; $property
= 12;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; update
(ObjectA);</font>
<br><font size=2 face="sans-serif">end</font>
<br>
<br><font size=2 face="sans-serif">rule rule2</font>
<br><font size=2 face="sans-serif">when</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; ObjectA
( $property : property!=null )</font>
<br><font size=2 face="sans-serif">then </font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; $property
= null;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; update
(ObjectA);</font>
<br><font size=2 face="sans-serif">end</font>
<br>
<br><font size=2 face="sans-serif">Try breaking things down into Ruleflow
Groups so that each logically separated section &nbsp;leads into the next.</font>
<br>
<br><font size=2 face="sans-serif">Another way of handling this is do not
have Update calls in your rules.</font>
<br>
<br><font size=2 face="sans-serif">Instead I attach listeners to each part
of the fact model - the listeners call Update for me.</font>
<br>
<br><font size=2 face="sans-serif">If I want to prevent loops? I simply
disable the listeners.</font>
<br>
<br><font size=2 face="sans-serif">On the current project I'm doing I've
done a combination of both of these, and it works well.</font>
<br>
<br><font size=2 face="sans-serif">I hope this helps,</font>
<br><font size=2 face="sans-serif">-Trav<br>
<br>
</font><font size=1 face="Arial"><b>Travis Smith</b><br>
Analyst Programmer<br>
Development Centre<br>
BNZ<br>
<br>
DDI: +644 4746356 (Or Ext 76356)</font>
<br>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td>
<br><font size=1 color=#800080 face="Arial"><b>dbfree75 &lt;wbismuth@yahoo.fr&gt;</b></font>
<br><font size=1 color=#800080 face="sans-serif">Sent by: </font><font size=1 color=#800080 face="sans-serif">rules-users-bounces@lists.jboss.org</font>
<p><font size=1 face="sans-serif">25/05/2011 11:55 a.m.</font>
<br><font size=1 face="sans-serif">Please respond to<br>
Rules Users List &lt;rules-users@lists.jboss.org&gt;</font>
<td>
<td>
<table width=100%>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td valign=top><font size=1 face="sans-serif">rules-users@lists.jboss.org</font>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td valign=top>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td valign=top><font size=1 face="sans-serif">Re: [rules-users] Update
function usage for java objects to be retrieved for database update</font></table>
<br></table>
<br>
<br>
<br>
<br><tt><font size=2>I'm still using such solution .<br>
Here an example of rule where I nees to set the<br>
originalPropertyValuationLoan :<br>
<br>
rule &quot;OriginalPropertyValuationLoan - NbSecuredGaranteeUnderLoan &gt;=
1 -<br>
garantee H - postCode equivalent - initialValue equivalent&quot;<br>
no-loop<br>
salience 970<br>
dialect &quot;mvel&quot;<br>
 &nbsp; &nbsp;when<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$controlFact
: ControlFact(phase == &quot;INITIAL&quot;)<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$loanEvaluated
&nbsp;: loanEvaluated(nbSecuredGaranteeUnderLoan &gt;= 1,<br>
originalPropertyValuationLoan == null)<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$loan
: loan() from $loanEvaluated.loan<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$garantee
: garantee(typegarantee.code == &quot;H&quot; , initialValue != null) from<br>
$loan.garantees<br>
 &nbsp; &nbsp; &nbsp; &nbsp;$postCodes : Set(size == 1)<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
from accumulate(<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; garantee(typegarantee.code
== &quot;H&quot;, $n :<br>
postCodeInGarantee) from $loan.garantees,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; collectSet($n)<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )<br>
 &nbsp; &nbsp; &nbsp; &nbsp;$garantees : Set(size == 1)<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
from accumulate(<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; garantee(typegarantee.code
== &quot;H&quot; ||<br>
typegarantee.code == &quot;O&quot;, $n : typegarantee.code) from $loan.garantees,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; collectSet($n)<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )<br>
 &nbsp; &nbsp; &nbsp; &nbsp;$initialValue : Set(size == 1) <br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;from accumulate(<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; <br>
garantee(typegarantee.code == &quot;H&quot;, $n : initialValue ) from $loan.garantees,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;collectSet($n)<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;)<br>
 &nbsp; then<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; $loanEvaluated.originalPropertyValuationLoan = $garantee.initialValue<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;update($loanEvaluated)<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;#System.out.println(&quot;OriginalPropertyValuationLoan
-<br>
NbSecuredGaranteeUnderLoan &gt; 1 : &quot; +<br>
$loan.loanEvaluated.originalPropertyValuationLoan);<br>
end<br>
<br>
In case this rule isn't fired because any of these conditions isn't set,
on<br>
update after any other property has been set &nbsp;this rule will be fired
again <br>
<br>
<br>
--<br>
View this message in context: http://drools.46999.n3.nabble.com/Update-function-usage-for-java-objects-to-be-retrieved-for-database-update-tp2981879p2982338.html<br>
Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
rules-users@lists.jboss.org<br>
https://lists.jboss.org/mailman/listinfo/rules-users<br>
</font></tt>
<br><pre>
CAUTION - This message may contain privileged and confidential information 
intended only for the use of the addressee named above. If you are not the 
intended recipient of this message you are hereby notified that any use, 
dissemination, distribution or reproduction of this message is prohibited. 
This email was sent by the Bank of New Zealand. You can contact us on 
0800 ASK BNZ (0800 275 269). Any views expressed in this message are those 
of the individual sender and may not necessarily reflect the views of Bank 
of New Zealand.
</pre>