[jboss-dev-forums] [TODO - DEVELOPMENT] - Re: Recursion in rules execution

vivonpereira do-not-reply at jboss.com
Fri Feb 9 09:39:09 EST 2007


You have to be very careful while using the 'OR' condition (||) in the JBoss rules. 
In the documentation that the JBoss have provided, they do mention that, every OR will be treated as a seperate sub-rule by itself. 
Hence, if u have a rule like this: condition1 || condition2, then the result is going to be executed twice for the two specified conditions.

Hence, i recommend u judiciously use the or condition.
Bcoz, if u have a condition like the one below, then the result would be totally wrong:
rule test
 when
    t:Test(age > 25 || skill == 'IT')
 then
    t.setWage(t.getWage() * 1000);
end

The result should have been 1000 but it would give 1000000.

There is one more point I have noticed in ur rule file is that, there are more than one rule containing modify method. When I wrote my rule file, it did not allow me to have more than one non-exclusive rule to have a modify method.
Could u tell me, didnt it throw u any error. Since it hangs my code when it finds two rules having modify method in the same drl file.
The java code is the same as urs.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4013647#4013647

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4013647



More information about the jboss-dev-forums mailing list